updateWorkspaceFolders may create an untitled workspace if none is defined #13181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
workspace#updateWorkspaceFolder() vscode API is not working when there is no active workspace. With this pull request, the updateWorkspaceFolder() now creates an unnamed workspace rather than throwing an error when trying to update folders on no active workspace.
Fixes #13100
Contributed on behalf of STMicroelectronics
How to test
The test can be done installing the following extension:
zip:
test-update-workspace-0.0.2.zip
src:
test-update-workspace-0.0.2-src.zip
The extension provides a command
Create Folder and Update Workspace
. This action can be triggered from the command palette and will try to create a folder and add it to the workspace.To test the initial issue pictured on issue 13100, the workspace shall not be defined. This can be done by opening a new Window from the browser version of theia. In the new window, use the
Create Folder and Update workspace
action. It will fail by telling that no workspace is active.With the pull request, this action does not fail anymore, as an unnamed workspace is created before adding the folder. This behavior is similar to the behavior currently implemented in vscode.
The current behavior is kept when the workspace is already a file or a folder.
Follow-ups
no follow up.
Review checklist
Reminder for reviewers