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

workspace: add workbenchState context key #10550

Merged
merged 2 commits into from
Jan 7, 2022
Merged

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes: #10549

The pull-request adds support for the workbenchState context key, which declares if there is no workspace (empty), a folder, or a workspace (multi-root) opened.

How to test

  1. include vscode-maven as a builtin extension
  2. start the application using theia as a workspace - confirm that the maven view in the explorer is not visible
  3. perform F1 > Reset Workbench Layout - confirm that the maven view in the explorer is not visible
  4. add a test pom.xml in the workspace (one of the activation events for the view)
  5. perform F1 > Reset Workbench Layout - confirm that the maven view is now visible

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto [email protected]

@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility workspace issues related to the workspace labels Dec 16, 2021
if (this.workspaceService.opened) {
return this.workspaceService.isMultiRootWorkspaceOpened ? 'folder' : 'workspace';
return this.workspaceService.isMultiRootWorkspaceOpened ? 'workspace' : 'folder';
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe the original code might have had the logic reversed.

this.updateStyles();
this.workspaceService.onWorkspaceChanged(() => {
this.updateEncodingOverrides();
updateWorkspaceFolderCountKey();
updateWorkspaceStateKey();
updateWorkbenchStateKey();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you expect that workspaceState and workbenchState may want to have different values in the future? In this code, they're updated in tandem and with the same values, so they could be combined.

The commit adds support for the `workbenchState` context key, which
declares if there is no workspace (empty), a folder, or a workspace
(multi-root) opened.

Signed-off-by: vince-fugnitto <[email protected]>
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

Eventually we may want to remove the workspaceState key, but this looks good for now.

@vince-fugnitto vince-fugnitto merged commit e0359d4 into master Jan 7, 2022
@vince-fugnitto vince-fugnitto deleted the vf/workenchState branch January 7, 2022 15:37
@vince-fugnitto vince-fugnitto added this to the 1.22.0 milestone Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility workspace issues related to the workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

workspace: add support for workbenchState context key
2 participants