-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Description
Rust-analyzer's current technique for auto inserting comments is with the following custom keybinding:
{
"key": "Enter",
"command": "rust-analyzer.onEnter",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
}(from rust-lang/rust-analyzer#4980)
The problem is that if the rust-analyzer extension is not installed or is disabled, pressing enter in the editor (when all the when conditions are met) throws a error with ⚠ command 'rust-analyzer.onEnter' not found and prevents the default return insertion.
Currently there isn't a way to prevent this apart from remove the keybinding temporarily.
This could be solved by adding a new context object. I looked at the when contexts and there isn't a extension one available in editor? Maybe "when": "extensions.available.has('rust-analyzer') && ..." ...?
Alternatively could this be done automatically, could vscode see that the extension is not available and ignore this keybinding?