-
Notifications
You must be signed in to change notification settings - Fork 295
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
VS Code: use enablement
for Cody commands
#4155
Conversation
vscode/package.json
Outdated
"command": "cody.command.edit-code", | ||
"category": "Cody Command", | ||
"title": "Edit Code", | ||
"when": "cody.activated && editorTextFocus", | ||
"enablement": "cody.activated && editorTextFocus", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cc @toolmantim @umpox, check out the "design input required" point in the PR description.
It affects most of the commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valerybugakov These current when
conditions are unused and probably just copy-paste errors. This particular command is also hidden in the commandPallete
setting like so:
"menus": {
"commandPalette": [
{
"command": "cody.command.edit-code",
"when": "cody.activated && editorIsOpen"
},
So I believe this works fine right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philipp-spiess all autocomplete commands are still enabled when autocomplete is disabled. I think we should fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the correct approach. most of the commands have entries in commandPalette
already and are already gated out (these are in prod, after all) so we shouldn't change this.
For those that aren't I'd say we err on the side of removing the check to avoid breaking anything. See this: #4157
@philipp-spiess, do we want to turn off some commands entirely in some cases? e.g., |
@valerybugakov What's the functional difference between turning-off via |
@philipp-spiess, probably one source of truth? If we know that the autocomplete manual trigger command should be disabled for both the command palette and the keybindings when autocomplete is disabled, should we do it in one place? In the current vesrion, it does not work as expected, probably because we assumed |
I think we should remove redundant |
@valerybugakov If it simplifies things than yeah, but I worry that we mess something up and break something in prod for this. Maybe we can check if commands have entries in both |
@philipp-spiess, from sources
So it should not break anything if we remove redundant |
when
configuration field is not applicable to commands:when
field is missing. Onlyenablement
is specified.when
fields toenablement
to hide Cody commands under certain conditions."cody.activated && editorTextFocus"
in multiple places. It does nothing in the current version of the extension, but with theenablement
field, it hides the respective command from the quick pick menu (shift+command+P) even when it's opened from the editor. Technically, the editor is not focused anymore; the quick menu is. So this configuration can be treated as: "the command will be hidden from the commands list, but will be available via keybindings ifeditorTextFocus
".Test plan
Can be done for all the commands based on the conditions specified in the
enablement
value.