Use `when` clause in keybinding overrides
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
I would love to use something like this:
"vim.insertModeKeyBindings": [
{
"before": ["ctrl", "p"],
"after": [],
"commands": [
{
"command": "editor.action.triggerSuggest",
"when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly && !suggestWidgetVisible"
},
{
"command": "selectPrevSuggestion",
"when": "editorTextFocus && suggestWidgetVisible"
}
]
},
{
"before": ["ctrl", "n"],
"after": [],
"commands": [
{
"command": "editor.action.triggerSuggest",
"when": "editorHasCompletionItemProvider && editorTextFocus && !editorReadonly && !suggestWidgetVisible"
},
{
"command": "selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetVisible"
}
]
}
]
Use-case
Demonstrates behavior of Ctrl + P in normal and insert modes.
Normal mode
Works without change - lets me find and open a file in a project.
Insert mode
When I do not have suggestion window visible, it will trigger the suggestion window to be visible.
When I do have suggestion window visible, it will go to previous suggestion.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the keybinding override configuration and its command-dispatch handling, then determine how existing keybindings are evaluated. Done means command entries can include when clauses so the appropriate command runs depending on editor and suggestion-widget context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vim, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100