aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-04 09:52:57 +0000
committerGitHub <[email protected]>2020-02-04 09:52:57 +0000
commitc1a06499fa5f9a40750cbfc30a7d399228a5fab0 (patch)
tree9f2a049a5d9e49c55f41fd27b1a264d051f044c9 /editors/code/src/main.ts
parent73c36fdbd2060bd455ffeef33dca1ecc2ae07ebb (diff)
parent875dc6d1a4973f70cd48b797ae755d1bd7a83fa5 (diff)
Merge #2981
2981: vscode: Add ability to call onEnter without overriding "type". r=matklad a=71 Before this PR, the only way to get enhanced typing (right now, only with `onEnter`) was to override VS Code's `type` command. This leads to issues with extensions like [VsCodeVim](https://github.com/VSCodeVim/Vim) that need to override `type` as well. This PR adds an additional command, `onEnter`. This command can be used with the following keybinding, which allows the user to get smart `onEnter` behavior without overriding `type`. ```json { "key": "enter", "command": "rust-analyzer.onEnter", "when": "editorTextFocus && editorLangId == rust" } ``` Co-authored-by: Gregoire Geis <[email protected]> Co-authored-by: GrĂ©goire Geis <[email protected]>
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts4
1 files changed, 1 insertions, 3 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 6813c3c4c..efc31b2e2 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -21,6 +21,7 @@ export async function activate(context: vscode.ExtensionContext) {
21 ctx.registerCommand('expandMacro', commands.expandMacro); 21 ctx.registerCommand('expandMacro', commands.expandMacro);
22 ctx.registerCommand('run', commands.run); 22 ctx.registerCommand('run', commands.run);
23 ctx.registerCommand('reload', commands.reload); 23 ctx.registerCommand('reload', commands.reload);
24 ctx.registerCommand('onEnter', commands.onEnter);
24 25
25 // Internal commands which are invoked by the server. 26 // Internal commands which are invoked by the server.
26 ctx.registerCommand('runSingle', commands.runSingle); 27 ctx.registerCommand('runSingle', commands.runSingle);
@@ -28,9 +29,6 @@ export async function activate(context: vscode.ExtensionContext) {
28 ctx.registerCommand('applySourceChange', commands.applySourceChange); 29 ctx.registerCommand('applySourceChange', commands.applySourceChange);
29 ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); 30 ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange);
30 31
31 if (ctx.config.enableEnhancedTyping) {
32 ctx.overrideCommand('type', commands.onEnter);
33 }
34 activateStatusDisplay(ctx); 32 activateStatusDisplay(ctx);
35 33
36 activateHighlighting(ctx); 34 activateHighlighting(ctx);