aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-02-07 10:37:36 +0000
committerVille Penttinen <[email protected]>2019-02-07 10:37:36 +0000
commit77a4a311fe22ac3b786378c452ab0f60e289cf87 (patch)
tree3deca42c8e3a5799d9ce83ce798c746164d2ed93 /editors/code/src
parent736a55c97e69f95e6ff4a0c3dafb2018e8ea05f9 (diff)
Add new configuration "enableEnhancedTyping" to control registering of "type" command
This further fixes problems when having a VIM extension (at least vscodevim) enabled, by not calling `overrideCommand('type', commands.onEnter.handle)` when enableEnhancedTyping is set to `false`. The problem is dependent on the order in which extensions are activated, if rust-analyzer is activated before `vscodevim`, rust-analyzer will register the `type` command, and when `vscodevim` finally attempts to activate, it will fail to register the command. This causes `vscodevim` to stop working properly. This setting allows users to disable the registerCommand `type` in rust-analyzer, allowing `vscodevim` to work. The setting defaults to `true`. Currently changing the setting requires reloading of the window.
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/config.ts25
-rw-r--r--editors/code/src/extension.ts4
2 files changed, 28 insertions, 1 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index d26f5df0a..d49917c78 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -6,8 +6,11 @@ const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
6 6
7export class Config { 7export class Config {
8 public highlightingOn = true; 8 public highlightingOn = true;
9 public enableEnhancedTyping = true;
9 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; 10 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
10 11
12 private prevEnhancedTyping: null | boolean = null;
13
11 constructor() { 14 constructor() {
12 vscode.workspace.onDidChangeConfiguration(_ => 15 vscode.workspace.onDidChangeConfiguration(_ =>
13 this.userConfigChanged() 16 this.userConfigChanged()
@@ -25,6 +28,28 @@ export class Config {
25 Server.highlighter.removeHighlights(); 28 Server.highlighter.removeHighlights();
26 } 29 }
27 30
31 if (config.has('enableEnhancedTyping')) {
32 this.enableEnhancedTyping = config.get('enableEnhancedTyping') as boolean;
33
34 if (this.prevEnhancedTyping === null) {
35 this.prevEnhancedTyping = this.enableEnhancedTyping;
36 }
37 } else if (this.prevEnhancedTyping === null) {
38 this.prevEnhancedTyping = this.enableEnhancedTyping;
39 }
40
41 if (this.prevEnhancedTyping !== this.enableEnhancedTyping) {
42 const reloadAction = 'Reload now';
43 vscode.window.showInformationMessage('Changing enhanced typing setting requires a reload', reloadAction)
44 .then(selectedAction => {
45 if (selectedAction === reloadAction) {
46 vscode.commands.executeCommand('workbench.action.reloadWindow');
47 }
48 });
49 this.prevEnhancedTyping = this.enableEnhancedTyping;
50 }
51
52
28 if (config.has('raLspServerPath')) { 53 if (config.has('raLspServerPath')) {
29 this.raLspServerPath = 54 this.raLspServerPath =
30 RA_LSP_DEBUG || (config.get('raLspServerPath') as string); 55 RA_LSP_DEBUG || (config.get('raLspServerPath') as string);
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index a0be70202..8b332eeb2 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -82,7 +82,9 @@ export function activate(context: vscode.ExtensionContext) {
82 } 82 }
83 ); 83 );
84 84
85 overrideCommand('type', commands.onEnter.handle); 85 if (Server.config.enableEnhancedTyping) {
86 overrideCommand('type', commands.onEnter.handle);
87 }
86 88
87 // Notifications are events triggered by the language server 89 // Notifications are events triggered by the language server
88 const allNotifications: Iterable< 90 const allNotifications: Iterable<