-
Notifications
You must be signed in to change notification settings - Fork 769
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
JSON config does not recognize Pylance as language server #16
Comments
Hi Tom We will likely add it as a valid language server setting option in the Python extension at some point so it doesn't get squiggled. However, as the set of choices in the Python extension must be statically declared, and as pylance is a separate extension and in early release, we felt that that was premature and installing it with a prompt to enable should be enough for now (and you can uninstall/disable the extension to turn it off). It is probably worth making this clearer in the documentation. |
Sorry, to clarify: should we still add Pylance as language server and ignore the warning? Or are you saying that Pylance becomes the language server just because it is installed and enabled? |
For now, add Pylance as language server and ignore the warning. Otherwise, it won't work. |
HI there I'm nre in this, how can we add pylance as language server ? |
When you install Pylance, it should pop up a dialog asking you if you'd like to make it the default language server for Python. Click "Yes", and it will update your settings accordingly. If you want to update your settings manually, set "python.languageServer" to "Pylance" as in the image at the top of this thread. |
I noticed that while the pop up dialog does correctly update my user's language server settings, no changes are made to the active workspace. Would you consider adding a second prompt for workspace updates as well? |
We expect to add For the initial release, we limited the set of behaviors down to be more managable (as there are quite a number of places to set the setting and orderings to install things). |
Pylint is still needed after pylance installation ? |
They do similar but different things. For live syntax errors and many other messages, pylint wouldn't be required, but there may be warnings/errors that pylint provides you may still use. AFAIK currently pylint won't run if an LS is enabled. |
Got it 👍 |
When I switch python.languageServer to Pylance I get this message "Please reload the window switching between language engines." prompting me to reload the settings window and also any (Python?) window I switch to. I have to ignore the message to keep Pylance enabled. Because if I do the reload, the setting switches back to what it was before (Jedi, in my case). |
No |
microsoft/vscode-python#13123 will add Pylance to the Python extension's choice list (as well as handle all of the edge cases that happen due to being able to change the setting whenever). We'll see when we can get it into a release of the extension. After that happens, Pylance will appear in the UI and not be warned in the settings. |
I logged an issue pertaining to Microsoft Pythong Language Server and noticed this suggestion in the inital bug reporting instruction text:
This made me install PyLance, since I thought that the issue I reported might have been corrected in the PyLance Language server. However, I then got a message suggesting an automatic change of the default Python language server to PyLance, which I accepted, but then there was the problem of the setting not being accepted as described above. I kept getting the message about the setting not being accepted even though reloading VSCode. I did read the explanation under #192 . Fine, that the pythong language server PyLance setting will only be accepted in the insiders build and not the stable version. However, in that case I think you should remove the general suggestion to install PyLance when reporting an issue in core Microsoft Python extension -- or just fix it so the setting works in the stable version. Make a decision! |
I think you may have misread #192. Pylance works with the stable build of the Python extension. The only difference is that it's not listed in the Python extension's package.json, so isn't in the UI and a warning appears when you open the JSON file (which can be safely ignored). If you set the setting manually and install Pylance (as per the readme), it should work fine. There is a known issue where the prompt may be confused if you set the languageServer setting somewhere other than globally, but should work past that. Pylance was released as a preview with a limited install path as there are numerous edge cases to consider when two extensions are required. We are opening up more ways to get it, and most of these issues will be solved at the next Python extension release. If you are saying that you have the setting set globally and don't have it set anywhere else, and you are using an official build of VS Code, and it's still not working, then we would appreciate a new issue with logs and system info to help us debug the problem. |
I tried again just now: a) Installed Pylance b) The message came up immediately: "Would you like to make Pylance your default language server for Python?" I select "yes, and reload". This leads to an eternal loop, i.e. VS Code reloads and the same prompt comes up again, If one ignores the prompt, it dissappears after a while but comes again when VS Code is started the next time. c) In both User and Workspace settings, one can only select "Microsoft", "Jedi" or "None". As you mention, though, one can set the setting manually in settings.json for the user. d) The PyLance language server may then work. But I keep getting the message "Would you like to make Pylance your default language server for Python?" when I start VS Code. The Quick Start section in the PyLance extension page does not metion any of these issues and states that one can update the setting through the prompt: Now, I am not sure if the described behaviour is just for my installation or this is how it works for everyone. But I hope you can understand that I find it confusing when I install this extension, following the instructions under "Quick Start" and then get an eternally looping prompt to change the default language server and reload, if I select Yes. Here is the system info: I am not that experienced with the logs of VS Code, so if you need them perhaps you can instruct me as to which logs are needed and where they are located. |
The prompt is appearing because there's somewhere in your config change that is changing This is the aforementioned known issue with the prompt; we are working on this. |
If you open a python file then check the "Python Language Server" output window, does it appear to be running Pylance, or something else? |
It says: "Starting Microsoft Python language server.". Which other places can the setting be located, which would override the settings.json setting? |
In some config file somewhere, you have "python.languageServer": "Microsoft", as the default would be Jedi. Check in files like The fix will be for the prompt to set |
I found a settings.json in the project folder, which was set to Microsoft Language Server. However, I think that it has lower priority than the user settings.json, so the prompt still comes up. I am not going to use anymore time on this but will just await the next release, which you say will fix the issue. Jake, thanks for the effort in troubleshooting this and have a nice weekend! Best regards, |
The workspace/project has higher priority than the user settings (user settings are the lowest, in fact). |
Hello,
I've just installed Pylance and started playing with it. In JSON config file I found this:
Pylance seems to be working:
My python version:
I think VSCode config file should recognize Pylance as a new language server.
Regards,
Tom
The text was updated successfully, but these errors were encountered: