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

updateWorkspaceFolders may create an untitled workspace if none is defined #13181

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

rschnekenbu
Copy link
Contributor

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:

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

@rschnekenbu rschnekenbu changed the title updateWorkspaceFolder may create an untitled workspace if none is defined updateWorkspaceFolders may create an untitled workspace if none is defined Dec 18, 2023
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally quite good to me. I have a question before approving, see below.

packages/workspace/src/browser/workspace-service.ts Outdated Show resolved Hide resolved
…ined

fixes eclipse-theia#13100

contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
@rschnekenbu
Copy link
Contributor Author

Thanks for your review, @msujew! I rebased my branch to be on top of master, and I also changed the error message as pointed out.

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, great. Looks good to me now 👍

@msujew msujew merged commit cdbfffc into eclipse-theia:master Dec 19, 2023
14 checks passed
@umar-shabbir
Copy link

Is this fix expected to be part of upcoming Theia monthly release?

@msujew msujew added this to the 1.45.0 milestone Dec 21, 2023
@msujew
Copy link
Member

msujew commented Dec 21, 2023

@umar-shabbir Yes, for some reason our automated PR-to-milestone assignment broke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

VS code API workspace.updateWorkspaceFolders is not working
3 participants