Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-root: Excluded file opens under wrong root #95056

Closed
GoaLitiuM opened this issue Apr 12, 2020 · 14 comments
Closed

Multi-root: Excluded file opens under wrong root #95056

GoaLitiuM opened this issue Apr 12, 2020 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues *out-of-scope Posted issue is not in scope of VS Code workbench-multiroot Multi-root (multiple folders) issues
Milestone

Comments

@GoaLitiuM
Copy link

Issue Type: Bug

I have a multi-root project setup in the following way:

  • Project folder including all sub folders except subproject1 folder
  • Subproject1 folder

When I open up a file located under subproject1 folder, the whole subproject1 folder gets collapsed in the explorer view and the opened file is shown under the main project root folder even though it is supposed to be excluded from it.

VS Code version: Code 1.44.0 (2aae1f2, 2020-04-07T23:31:18.860Z)
OS version: Windows_NT x64 10.0.19041

@GoaLitiuM
Copy link
Author

If I have the main project root folder collapsed and only the subproject1 folder revealed in explorer view, the opened files appear under the subproject1 folder.

@isidorn isidorn added feature-request Request for new features or functionality file-explorer Explorer widget issues workbench-multiroot Multi-root (multiple folders) issues labels Apr 13, 2020
@isidorn isidorn added this to the Backlog milestone Apr 13, 2020
@kdlslyv
Copy link

kdlslyv commented Apr 14, 2020

Yeah, happens here as well even with all extensions disabled.

Basically I have a structure with a project root directory, beneath a client/ and a server/ directory.
Now whenever I open an file under client/ or server/ it shows up in the project root folder too, plus the folder structure of where that file is.

When using Ctrl+P to navigate quickly, the explorer drawer annoyingly jumps around as well.

The entry disappears instantly once I close any of the files erroneously showing up there.

Expected behavior should be that none of these files mysteriously appear because these files under their folders are set to be excluded using files.exclude in the root directory .vscode/settings.json

@vennekilde
Copy link

vennekilde commented Apr 15, 2020

Same issue here

The issue with collapse of the folder, only occurs for folders located in the root project directory, so say you have
"folders": [{ "path": "folder/subfolder" }] then the folder will not collapse, however it will still be shown in the wrong root

Until this gets resolved, i recommend just commenting out the files.exclude section that excludes folders located in the root, as it is at least usable in this configures, though the folders will be shown twice.

Tested without any extensions on
Version: 1.45.0-insider
Commit: 1c36d74
Date: 2020-04-15T05:37:14.972Z
Electron: 7.2.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.19.0-2-amd64

@kdlslyv
Copy link

kdlslyv commented Apr 16, 2020

I think this issue is erroneously categorized, it clearly results in buggy behavior to me which earlier versions of vscode didn't have.

Should be labelled as a bug.

@GoaLitiuM
Copy link
Author

Yes, this is a regression, it worked in earlier builds but not after 1.44.0.

@vennekilde
Copy link

vennekilde commented Apr 27, 2020

Until this gets resolved, i recommend just commenting out the files.exclude section that excludes folders located in the root, as it is at least usable in this configures, though the folders will be shown twice.

Correction to my earlier statement.
If you require that your project is split into multiple roots, for things like gopls to work in a go module project, then there is nothing to do outside downgrading to a version < 1.44

Opening any file will make gopls believe it is part of the incorrect root it is opened under and will hence make it unable to resolve dependencies

@GoaLitiuM
Copy link
Author

@isidorn Can you correct the issue filing please? This is a bug, not a feature request.

@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Apr 27, 2020
@isidorn
Copy link
Contributor

isidorn commented Apr 27, 2020

Yes. Just did that. Thanks

@AndreasBackx
Copy link
Contributor

AndreasBackx commented May 24, 2020

Also bumped into this issue. It might be a regression as I used it before to work with Go projects that have multiple modules as it is the only workaround to get it to work. golang/go#32394

I made a repository that can reproduce this behaviour with a recording of it in action: https://github.com/AndreasBackx/vscode-exclude-bug

This does not seem to happen if the folder is nested. So ./cmd would produce the error but ./folder/cmd would not.

Okay it also seems to occur for nested folders if there is a file next to the ignored folder. :(

@ernestasjuska
Copy link

Yes. This is really annoying when working with deeply nested projects.

repro

Version: 1.47.0-insider (user setup)
Commit: 6c235c7
Date: 2020-06-26T06:20:06.931Z (1 hr ago)
Electron: 8.3.3
Chrome: 80.0.3987.165
Node.js: 12.13.0
V8: 8.0.426.27-electron.0
OS: Windows_NT x64 10.0.18363

expand_collapse.zip

@vennekilde
Copy link

vennekilde commented Oct 2, 2020

A "workable" solution is to move all your subproject folders into a folder under the root project

So if you have a project looking like this

./project
  ./subproject1
  ./subproject2

Then you can change it to this (remember to update .vscode/settings.json & project.code-workspace if used)

./project
  ./submodules/subproject1
  ./submodules/subproject2

Now when opening a file in one of the subprojects, it will not close the subproject folder on you

@TBBle
Copy link

TBBle commented Nov 15, 2020

Isn't "out-of-scope" the wrong way to close a bug report, according to the 'decision making process' definition? That probably should be "Won't fix", to make it clear that a regression bug has been decided to be kept, rather than treating it as a feature request that is not in scope.

@HHK1
Copy link

HHK1 commented Dec 7, 2020

Observing the exact same issue.
I looked around in the repo issues, and tried to add files directly as an alternative (#45177). I have to say that the number of valid and researched issues marked as "out-of-scope" on the subject of multi-root is worrying.

More transparency and explanations regarding those issues would be more helpful than just rejecting all those issues. There is a clear lack of support on multi-root workspaces, and it's hard to know wether to invest or not in this tool right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues *out-of-scope Posted issue is not in scope of VS Code workbench-multiroot Multi-root (multiple folders) issues
Projects
None yet
Development

No branches or pull requests

9 participants