Git Product home page Git Product logo

Comments (14)

memeplex avatar memeplex commented on May 21, 2024

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.

luabud avatar luabud commented on May 21, 2024

Related to microsoft/vscode-python#5132, if not dup

from pylance-release.

memeplex avatar memeplex commented on May 21, 2024

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.

DonJayamanne avatar DonJayamanne commented on May 21, 2024
  • 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.

memeplex avatar memeplex commented on May 21, 2024

@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.

DonJayamanne avatar DonJayamanne commented on May 21, 2024

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.

memeplex avatar memeplex commented on May 21, 2024

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.

vstest.zip

from pylance-release.

memeplex avatar memeplex commented on May 21, 2024

@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.

Allerka avatar Allerka commented on May 21, 2024

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.

aarwurzer2 avatar aarwurzer2 commented on May 21, 2024

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.

karthiknadig avatar karthiknadig commented on May 21, 2024

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.

jakebailey avatar jakebailey commented on May 21, 2024

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.

jakebailey avatar jakebailey commented on May 21, 2024

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.

heejaechang avatar heejaechang commented on May 21, 2024

it doesn't repro. I can see outlining for files under multi workspace root in the latest pylance.

from pylance-release.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.