-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Command 'python.analysis.restartLanguageServer' already exists #13441
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
Comments
Python 2020.8.101144 has many bugs, downgrade it to the one below it and everything should be fine. I issued a bug where the terminal would not accept any keyboard inputs and took me so long to realize what happened and its because python has a very recent update and downgrading it worked. |
Hi @HadenMoore, thank you for reaching out! Does this behaviour happen consistently, and would @yousefabuz17 downgrading suggestion work as a workaround for now? I couldn't reproduce your issue on macOS 10.15.6, VS Code 1.48.0 and the Python extension 2020.8.101144, what is the value of the Thank you! |
Hi @kimadeline , I can constantly reproduce this issue: firstly add multiple folders to a workspace, open a file in one folder, then switch to a file from another folder(it is the key point), then an error occurs:
Version: 1.49.1 |
Hi @leonhx, Do you have a sample repo I could use to reproduce the issue, because I did not experience this issue with the steps you outlined: What is what is the value of the Thanks! |
@kimadeline , your GIF showed exactly what I meant. In my settings, Here's a more specific reproduce procedure:
After the above steps finished, the logs from
Environment:
|
Thank you for the clarification and the repro steps @leonhx!
You can download it from the marketplace and install it alongside the core Python extension. Because our team's development efforts have shifted to support the new language server, we'd encourage you to try it out. @jakebailey In which repo do you want this issue to live? This is an MPLS-related bug, but the issue is with command registration, which happens in the extension. |
Here. The entire implementation of this command is in the core extension. These commands are unknown to any LS directly, as the core extension manages the entire lifetime of the LS. #12952 The command gets registered in the LS manager. There should only be one of those at as time depending on the LS setting choice. I'm not sure how it's possible without some violation of the injection system. |
Yeah, I don't know how that happens either. Maybe something to do with multi-root workspaces and being called for each workspace? In any case, it doesn't happen when using Pylance. |
We get this on our smoke tests now. https://github.com/microsoft/vscode-jupyter/runs/1398220329?check_suite_focus=true It seems like it would happen when switching language servers if you don't restart. |
My patch that added this adds the command disposal, but it's likely that it's not actually getting disposed for some reason. Maybe it needs to be shoved down further so that it can only be available when the LS is running. |
In the meantime maybe we could work around this in the commandRegistry by ensuring we call |
The problem would be if the old command is referencing a dead LS client, and therefore does nothing. I suppose that this is rare though where you need to change a setting (and are already in a bad state) and reload, so maybe it's not a huge problem. |
Followed the repro steps above (set language server to 'Microsoft', cloned the two repos, opened a Python file from each). It seems like what's happening is the following:
I debugged this locally and can verify that the constructor was called twice, and that's likely the source of the duplicate command registrations. Can the ILanguageServerManager be made a singleton? If a new one really needs to be created per folder in a workspace, the command may need to be registered elsewhere. |
It can't be a singleton due to multi-root (one MPLS per root), but that's been broken for a while. The individual LS is what needs to be restarted, so having more than one technically breaks that down because you have to ask "which LS to restart". It's likely my implementation was too simple and needed to go and restart every running LS or something, and register the command elsewhere. |
Yeah that makes sense, or maybe figure out which LS to restart based on the active root. In any case this error isn't fatal for our smoke tests so we don't urgently need a fix. |
+1 @kimadeline solution about use Pylance works!! But, I think that |
Uh oh!
There was an error while loading. Please reload this page.
Bug
python
2020.8.101144
Darwin x64 19.6.0
1.48.0
The text was updated successfully, but these errors were encountered: