Home > database >  Is there a bug when defined the return type of a function? As `def xxx() -> str:`, code highlight
Is there a bug when defined the return type of a function? As `def xxx() -> str:`, code highlight

Time:11-04

As def xxx() -> str:, code highlight whill be display error when I use ->

enter image description here

It's not a bug of the theme

If it can be solved by setting rules, can you help me solve it? Or a bug?

CodePudding user response:

You may have Inlay Type Hints enabled. Follow the steps below to disable.

File --> Preferences --> Settings, Search for python inlay hints, uncheck the two options in the picture.

enter image description here

Or directly add the following configuration in the settings.json file

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

More information can be found here and here.

CodePudding user response:

It's not a bug of vscode. It was caused by an extension I had installed, and now that plugin has been deprecated, name: "Python for VSCode"

  • Related