Skip to content

Commit

Permalink
Merge #3308
Browse files Browse the repository at this point in the history
3308: vscode: fix vscode-vim keybindings conflict r=matklad a=Veetaha

Closes #3013 I hope

vscode-vim extension overrides the `type` command so that it prevents
some keypresses to reach the text document editor.
It conflicts with our `onEnter` keybinding
that is used to support automatic doc comments extending and
indentation insertion.

The VSCode-native way to implement this would be
to use regular expressions, but as per matklad it is
considered not acceptable for the language server.

Thus we implement it via a `Enter` keybinding that
invokes our `onEnter` command which does it via the language-server.

At the end of the day we may only apply
ad hoc workarounds for conflicting extensions.
But vscode has another bug for that. You
either cannot use parantheses in `when` condition
of a keybinding or it just malfunctions.

See an issue about that here: microsoft/vscode#91473
To get the ultimate context, follow this [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing)

Co-authored-by: Veetaha <gerzoh1@gmail.com>
  • Loading branch information
bors[bot] and Veetaha committed Feb 27, 2020
2 parents 50956f8 + 655c833 commit 04b3bd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
{
"command": "rust-analyzer.onEnter",
"key": "enter",
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
"when": "editorTextFocus && !suggestWidgetVisible && editorLangId == rust && !vim.active || vim.mode == 'Insert' && editorTextFocus && !suggestWidgetVisible && editorLangId == rust"
}
],
"configuration": {
Expand Down

0 comments on commit 04b3bd5

Please sign in to comment.