Comments (14)
Ok, as commented in microsoft/python-language-server#1536 (comment), this seems to be a bug in vscode-python. A serious bug I would say because it kinda means that multi-root workspaces are not supported with the language server (?).
from pylance-release.
Related to microsoft/vscode-python#5132, if not dup
from pylance-release.
I think it's a dup but it's not making clear that it's strictly pls (not jedi) related and also it's a bit confusing by the fact it somehow relates the issue to venvs, which AFAICS have nothing to do with the problem (I'm not running inside a venv now and I can perfectly reproduce the issue).
from pylance-release.
- Please could you provide more information on what is working and what isn't.
- Please provide some sample code, screen shots.
I'd like to try to remote this at our end, without that it's difficult to tell what's working and what holes you have opened.
If possible provide a fit repo and a set of instructions to replicate the issue. - Are you opening files that don't belong to any of the 3 workspace folders? Or do they all belong to one of the three folders?
from pylance-release.
@DonJayamanne as for your first point, some things I could say aren't working are: empty outline for some files and also no ctrl-click style navigation for identifiers (as noted before, this happens for all files in a project or for no file in a project, and the failing projects vary from launch to launch, I think according to the first active editor but I can tell that for sure, it feels a bit random, but the first file always get an outline, for example). Regarding your third point, I'm not, all open files belong to one of the project folders. But the workspace settings file itself is in another directory, not in the same root containing the project folders. Regarding the second, I can't share the projects in my workspace but I will try to reproduce the issue in a minimal setting and send that to you; you will have to wait a few days though, since I'm very busy right now.
Please read also the comments they made in microsoft/python-language-server#1536.
from pylance-release.
Regarding the second, I can't share the projects in my workspace but I will try to reproduce the issue in a minimal setting and send that to you; you will have to wait a few days though, since I'm very busy right now.
Thanks for your patience. Will wait for your sample repo.
In it future, please could you got the issue in one repo.
Right now, we (both teams are looking at this issue), and we don't know where the issue is. I.re. were doubling the effort.
from pylance-release.
were doubling the effort.
It wasn't my intention, I let you both know that the issue was opened in both repositories, I thought it was better left to you to close one of them, but maybe it's preferable that you simply move issues between your repos, if that's possible.
Here you have a minimal example. It contains a two folder workspace. I have a configured a virtual environment in the venv folder, you will have to configure "python.pythonPath"
accordingly, and maybe "python.venvPath"
. Then open both mod1.py
and mod2.py
. Run code when mod1.py
was the last active tab before closing it, then switch to mod2.py
and you should have no outline information. Similarly swapping mod1.py
and mod2.py
.
from pylance-release.
@DonJayamanne please let me know if you need more info in order to reproduce the issue, since I still see the info-needed label.
from pylance-release.
I'm experiencing this issue too. I usually have multiple folders from a common root folder loaded into VS Code (as I frequently bounce between projects), and I've noticed the Outline function for Python files never works, usually just saying "The active editor cannot provide outline information" (very rarely saying no symbols were found in the file). Normally I run the extension remotely, but I've also tested this with it loaded locally, and accessing files locally and remotely, and at best the first Python file I open gets an outline, and the rest don't. I've also checked multiple other languages (JS, JSON, CSS, etc.) on both local and remote, and none of them have any trouble with the outline. As soon as I remove all but one folder from the workspace, the outline fires up fine. Trying to restart the language server (or reloading the window for that matter) has zero effect while multiple folders are open.
I've noticed in the output window for Python, it gives me several different errors when multiple folders are open:
- It can't find an active interpreter (I'm not sure why I have to keep re-specifying it after a reload when it doesn't change. Sometimes I have to reload the window again to get it to actually acknowledge the interpreter), even if one's shown as active at the bottom of the screen (i.e. the error pops up again when I open a new file).
- It can't find settings.json (because it's looking in the wrong folder, such as in /project/.config/Code/User/settings.json instead of /project/.vscode/settings.json or /root/.vscode/settings.json, or it's using the wrong kind of slashes).
- Or it can't find Python at all (only seems to happen if the extension is run locally).
The Language Server output remains blank as long as I've got multiple folders open.
Here's my setup info for reference:
- VS Code version: 1.48.0
- Extension version: 2020.8.101144 (Also tested with 2020.7.96456
- OS and version: Local, Windows 10, remote: Ubuntu 16.04
- Python version: Local, 3.8.1, remote: 3.5.2, 3.7.4, 3.8.2 (tested with all versions)
- Type of virtual environment used: N/A
- Relevant/affected Python packages and their versions: N/A (I think)
- Jedi or Language Server? Language Server
Any insight would be appreciated. I'd prefer to not have to keep four copies of VS Code open most of the time. Thanks!
EDIT: I forgot to add, if I switch from the MS language server to Jedi, it still doesn't work, and I start getting error messages about "Failed to initialize experiments" or "Failed to download and store experiments".
from pylance-release.
The issue is still persisting.
Having the same setup as described by @Allerka and @memeplex (albeit on newer versions of both VS Code and the extension, and using different OS). The issue starts as soon as you're adding a folder to the Workspace with the option File | Add Folder to Workspace...
.
So it's not just 'having different folders open', but it's really tied to the Workspace. As long as the Workspace is tied to one 'root' folder, there's no issue. Outline works correctly as can be verified by the using the command Go to Symbol in Editor
or Go to Symbol in Workspace
.
As soon as you add another folder to your Workspace with the option File | Add Folder to Workspace...
- and thus effectively creating multi-root Workspace - the Outline doesn't work anymore. The command Go to Symbol in Editor
will now display The active editor does not provide symbol information (and thus the reason that Outline info is not working, would be my guess). Removing the folder from the Workspace (and relaunching VS Code) again solves the issue.
The issue seems to be related to the Python extension, as the issue is not present with e.g. Markdown files.
My setup:
- OS: Local, Windows 10 x64 10.0.21390 (system setup)
- VS Code: Local, 1.56.2 (system setup)
- Python Extension: ms-python.python 2021.5.842923320
- Pylance Extension: ms-python.vscode-pylance 2021.6.0
- Jupyter Extension: ms-toolsai.jupyter 2021.6.832593372
- Using Language Server (Microsoft)
Any other useful info I should mention?
from pylance-release.
This is addressed with language server setting as JediLSP
, but not in Pylance
. In pylance already opened files don't get Outlines, but switching tabs and back seems to get the Outlines.
from pylance-release.
I guess this too is #1823, but again, we don't even receive the request when this happens. This can't be a Pylance problem, this is a client problem.
from pylance-release.
Hm, no, this may be slightly different, relating to adding workspaces?
@aarwurzer2 @karthiknadig Do any features work when you do the above? Or is it only the outline that is broken?
from pylance-release.
it doesn't repro. I can see outlining for files under multi workspace root in the latest pylance.
from pylance-release.
Related Issues (20)
- Github Issue HOT 1
- pylance crashing with cannot read properties of undefined (wsl) HOT 2
- No clue, but here you go. HOT 1
- Consider adding an option to disable localized translations of technical error messages or terms HOT 4
- Pylance settings parsing silently fails if path not exists
- Syntax highlighting does not support negative literals HOT 8
- CMD + LMB defaults to system stubs if module is overridden HOT 5
- Pyright emits meaningless `reportMissingModuleSource` warnings for submodules of native extension HOT 2
- Pylance informs me that enumerating my directory is taking a long time multiple times per minute
- Pylance Performace Issue (Reported by VS Code) HOT 1
- Pylance seem to have difference with class decorators HOT 4
- Inference on variables according to information provided by Paramspec HOT 4
- Is there any way to disable specific error messages? HOT 2
- Don't suggest imports from private modules HOT 2
- Pylance issue HOT 1
- Pylance behaviour on overloads doesn't match pyrights behaviour HOT 5
- Docstring tooltip bullet points not indented correctly if header is present HOT 2
- Error HOT 1
- Automatically Issues Report HOT 1
- "numpy" is not accessed pylance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylance-release.