-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pylint checks with pylance enabled #13315
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 |
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. |
I just want to confirm: I got |
Any news about it ?? vscode version: 1.49.1 |
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:
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: |
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. |
works for me also. |
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? |
Yes, manually modifying my User settings.json file works for me in a very large workspace with multiple languages present in both shared and seperate folders (if that was what you meant by your question). However, I noticed now when I tried some more, that if I open only a single file on Linux/Ubuntu with |
This is still a problem. Pylance does almost no linting in comparison to pylint. The linter enabled in the settings should not be silently disabled when enabled in the settings via the user interface. I have yet to try explicitly setting it in the json settings but it shouldn't be necessary. If I could use pylance and vscode at work and not get hounded during code review for code formatting issues that the linter would have caught, that'd be great. |
I could not agree more with @astrelsky. I too am in charge of code reviews and try to manage the general configuration for my fellow developers, and this issue is bugging me even more since Pylance has become the default language server in VSCode. I really love that environment, but currently it's really hard for me to enforce code quality without pylint. My configuration currently is as follow: User's settings.json: "python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.languageServer": "Pylance" Workspace's settings.json: "python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintUseMinimalCheckers": false,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
] And although everything has been explicitely enabled and my |
I tried your config on my Windows machine, with Python 3.9.6, VSCode 1.58.2, Pylance 2021.7.5, Python extension 2021.7.1053846006, pylint 2.9.5. In a simple workspace I get both pylance and pylint warnings as I expect them. So I don't know if your user/workspace settings actually is what you specified? Also I don't really know how/what you mean by "my But, yes, I agree that this is a big problem, Pylance should not force you to manually enable pylint in the .json settings file. |
We have deprecated the built-in support for Pylint in favour of the Pylint extesion. Pylint can now work side by side with Pylance by default once you install the extension (it actually ships with a version of pylint so you don't even need to install pylint in your environment for it to work either if you don't want to!) Keep in mind that some diagnostics displayed in Pylint won't be displayed in Pylance given Pylint also triggers stylistic warnings which Pylance does not. I'm closing this issue but if you have suggestions or feedback on Pylance's diagnostics feel free to file an issue at https://github.com/microsoft/pylance-release 😊 |
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 aretrailing-comma-tuple
and more, after switchingpython.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.;
pylint would complain about
b
andc
being unused, while pylance only complains aboutc
.Once again, super cool linter!
The text was updated successfully, but these errors were encountered: