Can't fully disable python linting Pylance VSCODE

33.3k views Asked by At

I've been searching online for quite a while now and can't seem to find a solution for my problem. I installed Pylance (the newest Microsoft interpreter for Python) and can't seem to disable linting at all. I've tried a lot of options but none worked. Here's a screenshot of how annoying linting is in my code now.

Here's how my VSCode Settings file looks like:

{
    // "python.pythonPath": "C://Anaconda3//envs//py34//python.exe",
    // "python.pythonPath": "C://Anaconda3_2020//python.exe",
    // "python.pythonPath": "C://Anaconda3_2020_07//python.exe",
    "python.pythonPath": "C://Anaconda3//python.exe",
    "python.analysis.disabled": [
        "unresolved-import"
    ],
    "editor.suggestSelection": "first",
    "editor.fontSize": 15,
    "typescript.tsserver.useSeparateSyntaxServer": false,
    "workbench.colorTheme": "Monokai ST3",
    "workbench.colorCustomizations": {
        "editor.background": "#000000",
        "statusBar.background": "#000000",
        "statusBar.noFolderBackground": "#212121",
        "statusBar.debuggingBackground": "#263238"
    },
    "window.zoomLevel": 0,
    "editor.renderLineHighlight": "none",
    "editor.fontFamily": "Meslo LG L",
    "editor.tabCompletion": "on",
    "editor.parameterHints.enabled": true,
    "python.terminal.executeInFileDir": true,
    "python.terminal.launchArgs": [
        "-u"
    ],
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "editor.lineHeight": 0,
    "workbench.editor.scrollToSwitchTabs": true,
    "python.autoComplete.showAdvancedMembers": false,
    "python.languageServer": "Pylance",
    "python.linting.enabled": false,
    "python.linting.pylintEnabled": false,
    "python.linting.lintOnSave": false,
    "python.linting.flake8Enabled": false,
    "python.linting.mypyEnabled": false,
    "python.linting.banditEnabled": false,
    "python.linting.pylamaEnabled": false,
    "python.linting.pylintArgs": [
        "--unsafe-load-any-extension=y",
        "--load-plugin",
        "pylint_protobuf",
        "--disable=all",
        "--disable=undefined-variable",
    ],
    "python.linting.mypyArgs": [
        "--ignore-missing-imports",
        "--follow-imports=silent",
        "--show-column-numbers",
        "--extension-pkg-whitelist=all",
        "--disable=all",
        "--disable=undefined-variable",
    ],
}

enter image description here

Any thoughts? Any help is much appreciated.

4

There are 4 answers

7
maxm On BEST ANSWER

You can disable the language server with:

"python.languageServer": "None"
2
akhildevelops On

Disabling language server works as answered by maxm. This will also disable other features.

Instead, just ignore the warnings and errors of pylance by setting below in settings.json of .vscode.

"python.analysis.ignore": [
        "*"
    ]

The other features will be present with out disabling pylance.

1
S.B On

One way of getting rid of those warnings in your picture is to disable the Pylance by setting "python.languageServer": "None"(already mentioned by the accepted answer).

But you are basically disabling the language server which means you will lose all the help from Pylance. I don't think this is what you want.

Instead you can exclude some paths and those won't get type-checking at all. I usually do it for Python's standard library.

In previous versions of Pylance, you could create a pyrightconfig.json(Pylance is built on top of Pyright, that's why) in the root of your workspace and put this inside(for more information - click):

{
    "ignore": [
        "path to your third-party package or stdlib or ..."
    ],
}

But since now (October 2022), you can directly set it in settings.json:

"python.analysis.ignore": ["path to your third-party package or stdlib or ...", ]

Remember you can use wild-cards in paths. This way your custom modules are only getting checked.

If you want to completely disable type-checking:

"python.analysis.typeCheckingMode": "off"
0
bsdvs23 On

I was able to click on the Extensions within VSC, search for Pylance and then right click to uninstall. You can also disable.