alefragnani / vscode-separators

Separators Extension for Visual Studio Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] - Incorrect behaviour with multi-root workspaces (workspaces that consist of multiple project folders)

aarwurzer2 opened this issue · comments

Environment/version

  • Extension version: 2.1.0
  • VSCode version: 1.56.2
  • OS version: Windows 10 x64 10.0.21390

Steps to reproduce
It appears that the extension is not working correctly when using files across different folders from a multi-root workspace setup. A multi-root workspace setup would be, when you've got different project folders in one workspace.

Setup files and folders first:

  1. create project folder test_project1
  2. create Python file test_file1.py within folder test_project1
  3. add some stub code in test_file1.py like: funct1(): pass
  4. create project folder test_project2
  5. create Python file test_file2.py within folder test_project2
  6. add some stub code in test_file2.py like: funct2(): pass

Create multi-root workspace

  1. Open VS Code with Separators extension installed (and active)
  2. Select File > Open Folder... and select the folder test_project1
  3. Load the file test_file1.py and verify the extension works correctly
  4. Select ** File > Add Folder to Workspace...** and select the folder test_project2
  5. Load the file test_file2.py and the Separator extension will start behave oddly now

I've tried several test, to see what works and what not:

  • just loading files from different folders, works as expected
  • if you create a normal workspace, and load a file from a folder outside of the workspace, the extension works correctly as well
  • the issues arises when you add a folder to the workspace with ** File > Add Folder to Workspace...**
  • removing the folder from the workspace restores the situation (but only after a reload)

Behaviour in VS Code with a multi-root workspace:
image

Simplified project folder setup for multi-root workspace:
image

Hi @aarwurzer2 ,

The extension relies on the language extension you have installed (in your case, some Python extension), to recognize and draw the separators for each symbol. If Separators is not working in some multi-root workspace scenario, I suppose the Python extension you use does not support multi-root Workspaces as well.

To be sure the Python extension is working properly, run the Go to Symbol command, or take a look at the Outline panel on Explorer view. If you see symbols there, Separators should work as well, otherwise, it won't.

Hope this helps

@alefragnani

It sure helps! The tip with the command Go to Symbol was useful in identifying the issue. So thanx for that!

My setup isn't anything particular and the extensions I'm using are the normal Microsoft supplied ones. So nothing out of the ordinary there. Tried also disabling all but the MS Python extensions - but nothing. Then I used your tip about using the command Go to Symbol, which doesn't work, as it says The active text editor does not provide symbol information. Again, tried everything but to no avail: as soon as you add another folder to your current workspace, the command Go to Symbol displays The active text editor does not provide symbol information - and once you get rid of that folder in your Workspace Symbols can be found again. And it appears to be linked to the Python extension.

So I went looking and apparently it is a bug - just not in your extension :)
There is bug 7328 that exactly describes my behavior regarding Python and multi-root workspaces: issue with generating symbols in multi-root workspace. It's been going on for a while and more people are suffering from it. From the looks of it, they should be starting working on it. I've added my comment as well.

Again, thanks very much for pointing me in the direction of the command Go to Symbol. As the bug is not in your extension, I guess we could close this one.

That's great to see you found the source of the issue.

I heard a few language extensions had issues with multi-root workspaces, but didn't know Python was one of them. MS is investing a lot on Python recently, so I guess multi-root support could be added soon.

Thank you