-
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
Multi-root workspace support prevents extension from recognizing files outside workspace #5132
Comments
@DonJayamanne Can you make this an official ask for the VS Code team? |
We should spike on this: #9328 |
I am having an issue where the Microsoft Python Language Server stops working when editing and switching between files in different workspaces, when in a multi-root workspace environment. I reported this issue on the MPLS repo (microsoft/python-language-server#1962) : the maintainers there believe that my crash issue is rather on the side of the Python extension, and that is is probably linked (if not identical) to this very issue. Steps to reproduce :
|
I traced the above issue down while working on another multi-root LS PR; I'll file that as another bug as I believe it's a regression from a release earlier this year (#8815) to do with only having a single LS running at a time depending on the user's activity. |
I've got the same problem, where intellisense will stop working when I change between files in my multi-root workspace. I can reproduce it consistently by opening vscode with a file in one workspace, changing to a file in the other workspace, then changing back. Any fix or workaround would be great. |
I switch to Pylance, it is not perfect, but it works when multi-root worksapce |
Yep, Pylance is definitely the way to go now, I also did the switch and it works better. I think support for the MPLS is going to be progressively dropped as well, as Pylance is now Microsoft's main Python LS if I'm not mistaken. |
Is this still an issue once Microsoft Language Server is gone? |
Nope, Pylance handles workspaces natively. This was a bug with the hacky logic we had to use to spin up multiple MPLS instances. |
With the multi-root workspace support added in #4244, files which do not reside in a workspace (including library code that doesn't live in a virtualenv inside the opened folder) are not properly classified, and the extension/editor does not recognize them. This affects goto-def (see microsoft/python-language-server#840), but also opening random files that aren't in the currently open folder.
This behavior likely comes from this line: https://github.com/Microsoft/vscode-python/pull/4244/files#diff-f60110caa225d7026d0cffec5d66270fR109
Which I interpret to mean "only treat files within this root as Python", as well as to help distinguish one workspace from another. This has the unfortunate side effect of preventing files that don't match those patterns from "being" Python and then handled by the extension.
Interestingly, if you open a file (and have it not be recognized), then reload VS Code, then the file is recognized as normal, which may hint that there's a way to avoid the problem (or that it's just a bug).
The text was updated successfully, but these errors were encountered: