Skip to content

Remove coder.openFromSidebar from command list #364

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

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove coder.openFromSidebar from command list
When searching for "open workspace" in the palette, this can come up
instead of the correct one (`coder.open`, also titled "open workspace").

coder.openFromSidebar should only be used to open workspaces from the
sidebar, it never makes sense for a user to manually run it from the
command palette because even if you have a tree item selected, it will
not be passed when running from the command palette; the tree item only
exists if you click the inline button.

If there was a way to get the selected tree item, it would be ideal to
enable the command while there was one (this would also allow adding a
key binding), but since there is not, use `false` to always hide it.
  • Loading branch information
code-asher committed Sep 24, 2024
commit 553287690d9212fc18cbb971ae82948ea3de1ccd
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@
}
],
"menus": {
"commandPalette": [
{
"command": "coder.openFromSidebar",
"when": "false"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just real quick can you explain how this setting works? Why provide a command we don't want people to run?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need the command to run it in a context menu from the sidebar:

vscode-coder/package.json

Lines 216 to 220 in 2d428eb

{
"command": "coder.openFromSidebar",
"when": "coder.authenticated && viewItem == coderWorkspaceSingleAgent || coder.authenticated && viewItem == coderAgent",
"group": "inline"
},

But, while we want it in the context menu where it has access to a selected workspace, we do not want it in the palette, where there is no selected workspace.

Copy link
Member Author

Choose a reason for hiding this comment

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

Commands show up by default in the palette, so we have to explicitly prevent that with the when. Feels janky to me but apparently this is the intended way lol

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree haha

}
],
"view/title": [
{
"command": "coder.logout",
Expand Down