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

Changing first workspace folder restarts extensions #46048

Closed
amp343 opened this issue Mar 18, 2018 · 2 comments
Closed

Changing first workspace folder restarts extensions #46048

amp343 opened this issue Mar 18, 2018 · 2 comments
Labels
*as-designed Described behavior is as designed

Comments

@amp343
Copy link

amp343 commented Mar 18, 2018

Issue Type: Bug

Changing the first folder in a workspace restarts the extension host.

This is a problem because it breaks the extension's ability to listen for workspace lifecycle events like workspace.onDidChangeWorkspaceFolders (the extension cannot catch an event that changes folder 0 since it's being restarted).

VS Code version: Code 1.21.1 (79b44aa, 2018-03-14T14:39:09.335Z)
OS version: Darwin x64 17.3.0

Reproduces without extensions

@amp343
Copy link
Author

amp343 commented Mar 18, 2018

This issue directly affects extensions that use the proposed FileSystemProvider api (https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.proposed.d.ts#L227).

Test:

  1. An extension registers a filesystem provider with workspace.registerFileSystemProvider for a certain scheme (e.g., ftp)
  2. Adding folders to the workspace that have this scheme work fine; that is, they are handled by the intended provider ✅
  3. Moving folders around that affect the first folder in the workspace breaks this pattern though; the extension restarts, and the mapping between scheme and provider is lost (even if the extension re-establishes it on its activation event). Workspace files that have been fetched with the intended provider will now attempt to be accessed with the default filesystem provider, resulting in ENOENT etc. ❌

This can be confirmed with the https://github.com/jrieken/ftp-sample extension, or another similar implementation.

mar-18-2018-06-04-513
Hard to see, but the workspace root served by the ftp provider goes empty and throws an ENOENT after the first workspace folder is modified (its extension is restarted).

@bpasero
Copy link
Member

bpasero commented Mar 19, 2018

Unfortunately this is by design so that we do not break our deprecated rootPath property in the API that is always the first root folder but cannot change during runtime without a restart.

/cc @jrieken

@bpasero bpasero closed this as completed Mar 19, 2018
@bpasero bpasero added the *as-designed Described behavior is as designed label Mar 19, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed
Projects
None yet
Development

No branches or pull requests

2 participants