Search code examples
pythonvisual-studio-codesuppress-warningspylance

In VSCode, prevent PyLance warning: Invalid character in identifier


After an update to VSCode's Python plugin, PyLance is causing trouble.

        def ð’€–(f, *args):
            if f:
                f(*args)

... causes "Invalid character in identifier"

enter image description here

How to disable these warnings?

Maybe I need to create ./.vscode/settings.json with:

{
    "python.analysis.disabled": [
        "I want something like:", "invalid-character-in-identifier" ],
}

... but can't find anything suitable on https://code.visualstudio.com/docs/python/settings-reference#_python-language-server-settings

Can I extrapolate the token I need somehow from VSCode?

PS Please do not critique the use of unicode variable names. That's not at point here. The variable name is valid, and the runs from the commandline.


Solution

  • It's a bug: https://github.com/microsoft/pylance-release/issues/1286

    Expect a fix in the next VSCode version.

    EDIT: It's been fixed!