microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 767 forks source link

"Rename symbol" and "Go to references" are incomplete in multiroot workspace #133

Closed ErwanDL closed 2 years ago

ErwanDL commented 4 years ago

Environment data

Expected behaviour

In a multiroot workspace where different workspaces use each other as packages, when using the actions "Rename symbol" (resp. "Go to references") on a symbol, it should rename (resp. find references of) the symbol across all workspaces, and not just the current one.

Actual behaviour

"Rename symbol" only renames occurrences of the symbol in the current workspace. Similarly, "Go to references" only shows references of the symbol in the current workspace.

Steps to reproduce

Here is a sample project that illustrates this bug : https://github.com/ErwanDL/pylance-multiroot-example

In this GIF I try to rename the class Foo, you can see it is properly renamed in all files of workspace1, but not in workspace2.

pylance-renaming-fails

jakebailey commented 4 years ago

Just to update this, this is due to the internal way we handle multiple workspaces. Each workspace is its own "program" (basically "the analysis"), but aren't aware of each other. This can lead to states where one workspace may refer to a file in the other but not vice versa, and therefore when you search for things only one of them actually knows the other exists. This is a known limitation at the moment.

(But, I think our current state is still an improvement over the old language server whose multiroot support was iffy at best.)

ErwanDL commented 4 years ago

I see, indeed this does not seem to be an obvious change, but it would be very appreciated if it was handled 🙂 Refactoring is one of the rare areas where PyCharm still has an edge, but I'm loving all the work you put in to bridge the gap ❤️

fkromer commented 4 years ago

Refactoring is one of the rare areas where PyCharm still has an edge, but I'm loving all the work you put in to bridge the gap heart

The refactoring features in combination with good overview over changes (GitLens) after refactorings are one of the advantages in comparison to command line based editors like vim, spacemancs, etc. Features like that are what makes VSCode stand out actually. If they work. BTW there is still the Jedi language server as fallback :)

JosXa commented 3 years ago

rare areas where PyCharm still has an edge

+1 on this. The old language server was a nightmare, but with Pylance things are really changing to the point where I'm now almost ready to make the switch. JetBrains are either incapable of or indifferent about adding proper typing and giving PyCharm the love it deserves, so I'm really looking forward to Pylance catching up in those other last remaining areas and unifying my IDE experiences.

judej commented 2 years ago

Moving this issue to discussion as an enhancement request for comments and upvotes.