Home > front end >  Disable inlay type hints for literals in Pylance?
Disable inlay type hints for literals in Pylance?

Time:12-31

The inlay type hints in Pylance is great and helps with legacy code. However, type hints for literals clutter up the editor with no new information.

clutter up the editor with no new information

For Enums, this is especially annoying.

this is especially annoying.

Is there a way to disable type hints in only these scenarios?

I could not find more settings than

"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.variableTypes": true,

CodePudding user response:

No, There is no option available at the moment for disabling this feature only for literals. Inlay Type Hints with plylance is recently released and it only provides following two types.

In this release, we have added two types of inlay hints when using Pylance: for variable types and for return types.

Return type inlay hints show the return types of functions that don’t have an explicit annotation. To enable it, you can set “python.analysis.inlayHints.functionReturnTypes”: true to your user settings (Preferences: Open Settings (JSON) command).

Similarly, variable type inlay hints show the types of variables that don’t have explicit type annotations. You can enable it by setting “python.analysis.inlayHints.variableTypes”: true.

May be you can submit a feature request/issue here

  • Related