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

Unexpected events for single updateWorkspaceFolders operation #42639

Closed
weinand opened this issue Jan 31, 2018 · 2 comments
Closed

Unexpected events for single updateWorkspaceFolders operation #42639

weinand opened this issue Jan 31, 2018 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debt Code quality issues verified Verification succeeded workbench-multiroot Multi-root (multiple folders) issues
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Jan 31, 2018

testing #42195:

  • workspace with 4 folders f1, f2, f3, f4
  • code that swaps f2 with f3 (but removes and adds f4 unnecessarily):
    const folders = vscode.workspace.workspaceFolders;
    vscode.workspace.updateWorkspaceFolders(1, folders.length-1, folders[2], folders[1], folders[3]);

For this single operation I get these two events:
onDidChangeWorkspaceFolders: added: 0, removed: 3
onDidChangeWorkspaceFolders: added: 3, removed: 0

I would have expected to only receive a single event:
onDidChangeWorkspaceFolders: added: 2, removed: 2

(or even better a single changed event:
onDidChangeWorkspaceFolders: added: 0, removed: 0, changed: 2
)

Another case:
renaming a folder with this code:

        const folders = vscode.workspace.workspaceFolders;
        vscode.workspace.updateWorkspaceFolders(1, 1, { uri: folders[1].uri, name: folders[1].name + 'x' });

results in two events too.

@bpasero bpasero added the workbench-multiroot Multi-root (multiple folders) issues label Jan 31, 2018
@bpasero
Copy link
Member

bpasero commented Jan 31, 2018

Yeah this is another issue similar to #42625 where all I have is a remove and add API, where I should change to have an API that allows for both things at once.

@bpasero bpasero added the debt Code quality issues label Jan 31, 2018
@bpasero bpasero modified the milestones: January 2018, February 2018 Jan 31, 2018
@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label Feb 5, 2018
@bpasero bpasero closed this as completed in e9650bd Feb 5, 2018
@joaomoreno
Copy link
Member

I now see added 0 removed 0 for both examples. 👍

@joaomoreno joaomoreno added the verified Verification succeeded label Mar 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debt Code quality issues verified Verification succeeded workbench-multiroot Multi-root (multiple folders) issues
Projects
None yet
Development

No branches or pull requests

3 participants