Add "Default" LS setting, which picks between Jedi/Pylance - #16155
Conversation
There was a problem hiding this comment.
Please check my comments here #16139 (review). Also, shouldn't we add a news entry?
|
Yes, getting there... :) |
|
I still need to check a few things:
|
| const serverType = configurationService.getSettings(this.resource).languageServer; | ||
| if (serverType === LanguageServerType.Node) { | ||
| return 'shared-ls'; | ||
| return LanguageServerType.Node; |
There was a problem hiding this comment.
The key is compared against the server type in some conditions (bad!), but this will at least make things not break in those cases.
|
Jake Bailey (@jakebailey) I feel really bad about the idea of forcing Python 2 developers to use Jedi engine. Is there any chance to leave out this? |
|
See #16204, but Pylance wasn't really intended to work with Python 2 in the first place. |
|
It would be perfect to bring your idea to life. Until this point, Pylance gave me really great experience with Python 2. |
|
I know this isn't the right place for support, but I'm curious if there is a way to tell what language server is being used when "Default" is selected. I have struggled with and reconfigured VS Code's language server for python for a while, and I'm not sure if some other existing configuration I have is making it so "Default" resolves to Pylance, Jedi, or something else. |
|
The "Python" logs print a message for the chosen language server, like:
Or
Or similar. Additionally, the "Python Language Server" output window will have logs specific to the language server chosen, or not exist at all (because "Jedi" is technically not a language server). |
|
Thanks. Seeing "Starting Jedi Python language engine." Now trying to figure out why... Update: I found that I had to add I also notice in my logs "User belongs to experiment group 'pythonJediLSP'" - not sure if this is causing issues, and I can't see a place where I would be opted in to this experiment. |
What version of the Python extension are you using? That setting hasn't been used anywhere in months. |
Id: ms-python.python Id: ms-python.vscode-pylance It looks like setting Looks like I'm back to Jedi. I'm using the Remote - Containers extension with the following // For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
"name": "Example",
"image": "example.com/image:local",
"workspaceMount": "source=${localWorkspaceFolder},target=/cestem,type=bind,consistency=cached",
"workspaceFolder": "/cestem",
"settings": {
"python.pythonPath": "/usr/bin/python",
"python.testing.pytestArgs": [],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true,
"python.linting.flake8Enabled": false,
"python.linting.pylintEnabled": true,
"python.linting.pylintUseMinimalCheckers": false,
"python.formatting.provider": "black",
"python.jediEnabled": false,
"files.autoSave": "afterDelay"
},
"extensions": [
"ms-python.python"
]
} |
|
If |
|
If you want to opt out of the JediLSP experiment, add the following to your settings.json: "python.experiments.optOutFrom": [
"pythonJediLSP"
], |
|
When I change the Python language server to Pylance, I see that Pylance is started instead of Jedi.
|
|
That I'm unsure of and would be worth a new issue (this is just a PR, after all). AFAIK, dev containers should run their extensions internally. Otherwise, I'm sure there are loads of discrepancies all over the board... |

Resending #16139.
For #16157.
Adds a new "Default" setting, which implies Pylance when Pylance installed, otherwise uses jedi (plus/minus the LSP experiment).
For https://github.com/microsoft/vscode-python-internalbacklog/issues/176.