Vscode-python: pylint checks with pylance enabled

Created on 1 Jul 2020  路  15Comments  路  Source: microsoft/vscode-python

Dunno if this should be a bug report or feature request...

First of all, I just installed and used pylance as the language server for my vscode and it is indeed SUPER! thanks.

However, I had setup plenty of custom python.linting.pylintArgs to check in my code, for example on my most occuring bugs are trailing-comma-tuple and more, after switching python.languageServer to "Pylance" these checks stopped being checked for.

As said, I would consider this a feature request that pylance should support these checks.

Another example is, unused variables, in pylint I got unused variables error for unused arguments in function signatures, while pylance only checks for code blocks, i.e.;

def function(a, b):
    c = 42
    return a

pylint would complain about b and c being unused, while pylance only complains about c.

Once again, super cool linter!

area-linting investigating

All 15 comments

Can you check your 'PyLint enabled' setting? Maybe you just need to re-enable it.

Yes, I checked, and it is explicitly set to true.

Interesting; I would have assumed it was just being disabled by default by the extension. For reference, the extension uses pylint by default (in conjunction with other tools) to provide at least some info like syntax checks without a language server, so I can see why it may disable that tooling if an LS is there to do "live linting" (among everything else an LS does).

That is exactly why I came here, to open a bug report.

I love vscode along with the python extension, and now we got pylance which is super as well!

The least I can do is give some testing help...

It looks like pylint only runs when LS is set to Jedi. It doesn't run LS set to with MPLS or pylance. There is some risk of clobbering here but it seems we should still run the linter, especially if we have listing on save set.

This looks like a bug, LS activation does turn off linter by default but explicit setting should work. This may need to get ported to https://github.com/Microsoft/vscode-python

Transferred; AFAIK it's a behavior change in the extension to allow pylint to run while an LS is active.

It looks like pylint only runs when LS is set to Jedi. It doesn't run LS set to with MPLS or pylance. There is some risk of clobbering here but it seems we should still run the linter, especially if we have listing on save set.

I just want to confirm: I got pylint working again with all my settings with Jedi on Pyton 3.8.5 so far I didn't manage to make it work on my 2.7.18 project :/ But I got some console output working. It's in the Output-tab unter "Python"...

Any news about it ??
also trying to set LS to Jedi didn't solved the issue

vscode version: 1.49.1
Python 3.7.7

I found out about pylance just a couple of days ago and enabled it. It is very nice, but I too lost all my linting from pylint. I found this issue after searching for a solution.

After some more trial, I seem to have been able to re-enable pylint without changing the language server (i.e. I get both pylance and pylint warnings). I did this by explicitly enabling pylint in my settings.json file. So my settings.json now include, among other lines:

    "python.linting.pylintEnabled": true,
    "python.languageServer": "Pylance",

I had to make the change manually in settings.json, just checking the setting "Python > Linting: Pylint Enabled" in the graphical settings meny in VSCode was _not_ enough (that was marked as enabled the whole time). Why this works I don't really know, but it seems to work for me at least. Also, the order of the lines in settings.json doesn't seem to matter. I have tried this on both a Linux and a Windows machine.

I hope this can help someone else.

Windows machine config:
VSCode: 1.49.2
Python: 3.8.5
Pylint: 2.6.0
Python extension: 2020.9.112786
Pylance extension: 2020.9.7

A small update.

Looks like the problem is only for Workspace with multiple folders.

workspace-dir
    |
    + <filename>.code-workspace
    |
    + python directory
    |
    + other directories ...

A small update.

Looks like the problem is only for Workspace with multiple folders.

Hmm, I have seen this issue in a workspace with only a single python file in the root of the workspace, and no other files or directories. I also got the same issue when opening a python file without a workspace. My solution by manually updating the User settings.json worked for both.

I found out about pylance just a couple of days ago and enabled it. It is very nice, but I too lost all my linting from pylint. I found this issue after searching for a solution.

After some more trial, I seem to have been able to re-enable pylint without changing the language server (i.e. I get both pylance and pylint warnings). I did this by explicitly enabling pylint in my settings.json file. So my settings.json now include, among other lines:

    "python.linting.pylintEnabled": true,
    "python.languageServer": "Pylance",

I had to make the change manually in settings.json, just checking the setting "Python > Linting: Pylint Enabled" in the graphical settings meny in VSCode was _not_ enough (that was marked as enabled the whole time). Why this works I don't really know, but it seems to work for me at least. Also, the order of the lines in settings.json doesn't seem to matter. I have tried this on both a Linux and a Windows machine.

I hope this can help someone else.

Windows machine config:
VSCode: 1.49.2
Python: 3.8.5
Pylint: 2.6.0
Python extension: 2020.9.112786
Pylance extension: 2020.9.7

works for me also.

I found out about pylance just a couple of days ago and enabled it. It is very nice, but I too lost all my linting from pylint. I found this issue after searching for a solution.

After some more trial, I seem to have been able to re-enable pylint without changing the language server (i.e. I get both pylance and pylint warnings). I did this by explicitly enabling pylint in my settings.json file. So my settings.json now include, among other lines:

    "python.linting.pylintEnabled": true,
    "python.languageServer": "Pylance",

I had to make the change manually in settings.json, just checking the setting "Python > Linting: Pylint Enabled" in the graphical settings meny in VSCode was _not_ enough (that was marked as enabled the whole time). Why this works I don't really know, but it seems to work for me at least. Also, the order of the lines in settings.json doesn't seem to matter. I have tried this on both a Linux and a Windows machine.

I hope this can help someone else.

Windows machine config:
VSCode: 1.49.2
Python: 3.8.5
Pylint: 2.6.0
Python extension: 2020.9.112786
Pylance extension: 2020.9.7

Solved for me on WSL, VSCode v1.50, Pylance v2020.11.0, Python ext v2020.10.332292344

Does this trick work also with workspace (multi-language) projects?

Was this page helpful?
0 / 5 - 0 ratings