Repository navigation
Multi-root workspace support prevents extension from recognizing files outside workspace #5132
Description
Activity
- ghost addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Apr 5, 2019 - ghost removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Apr 5, 2019 - addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-teamarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.
on Apr 5, 2019 - ghost removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Apr 5, 2019 - addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-teambugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
on Apr 5, 2019 - ghost removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Apr 5, 2019 - added this to the 2019, week 13 - March Sprint 7 milestone
on Apr 5, 2019 - modified the milestones: 2019, week 13 - March Sprint 7, 2019, week 15 - April Sprint 8
on Apr 10, 2019 30 remaining items
- removedimportantIssue identified as high-priorityIssue identified as high-priority
on Dec 30, 2019 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 :
- Create 2 folders with one Python file in each, respectively called test1.py and test2.py.
- Add these 2 folders to a new Multi-Root Workspace, and open this Multi-Root Workspace with VSCode.
- Open test1.py. Hover on variable names, try to import modules, assert that everything is working OK.
- Open test2.py. Hover on variable names, try to import modules, assert that everything is also working OK.
- Switch back to test1.py : intellisense, hovering, auto-complete of import paths should not be working anymore.
- Everything should still be working fine for test2.py though.
Reacted by lovepocky, Li Huanshuai and Mike Gedelmanjakebailey commented
on Apr 21, 2020 MemberAuthorMore actionsI 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.
Reacted by Erwan de Lépinau and NikEyXI'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.
Reacted by Dmytro Sadovnychyi and Jeffrey StarkerI switch to Pylance, it is not perfect, but it works when multi-root worksapce
Reacted by Erwan de Lépinau, musicaudience and Weston PlatterReacted by musicaudienceYep, 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.
- addedinvestigatingWe are looking into the cause of the issueWe are looking into the cause of the issueand removed
on Sep 15, 2020 Is this still an issue once Microsoft Language Server is gone?
jakebailey commented
on Oct 22, 2021 MemberAuthorMore actionsNope, Pylance handles workspaces natively. This was a bug with the hacky logic we had to use to spin up multiple MPLS instances.
Reacted by Kartik Raj- locked as resolved and limited conversation to collaborators
on Nov 26, 2021
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).