aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-22 13:34:04 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-22 13:34:04 +0000
commit5a5402d4d4ab033f0035622df880c82ea064d2c5 (patch)
treea0224a5e049e27f61c20f8d7fd0b723e832192b6 /editors
parent5c7e8f47a8318e744b8e5d5bcb127ca9753ca04b (diff)
parent0f5d9a03221ec9a4597f3e0bc29f210607713cb4 (diff)
Merge #322
322: Fix analyzer extension fail when there are enabled any VIM extension r=matklad a=max-frai `type` command is allowed only once to be registered and it was built specially for vim mode. So if user has vim extension enabled, rust-analyzer initialization failes on trying to register own `type` handler. Unfortunatelly, there are no nice ways to check if command is already registered so the way is to wrap everything with try/catch and notify user about conflict. Co-authored-by: frai <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/extension.ts30
1 files changed, 17 insertions, 13 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index d1c525f68..4acd54d90 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -23,19 +23,23 @@ export function activate(context: vscode.ExtensionContext) {
23 const original = (...args: any[]) => 23 const original = (...args: any[]) =>
24 vscode.commands.executeCommand(defaultCmd, ...args); 24 vscode.commands.executeCommand(defaultCmd, ...args);
25 25
26 registerCommand(name, async (...args: any[]) => { 26 try {
27 const editor = vscode.window.activeTextEditor; 27 registerCommand(name, async (...args: any[]) => {
28 if ( 28 const editor = vscode.window.activeTextEditor;
29 !editor || 29 if (
30 !editor.document || 30 !editor ||
31 editor.document.languageId !== 'rust' 31 !editor.document ||
32 ) { 32 editor.document.languageId !== 'rust'
33 return await original(...args); 33 ) {
34 } 34 return await original(...args);
35 if (!(await f(...args))) { 35 }
36 return await original(...args); 36 if (!(await f(...args))) {
37 } 37 return await original(...args);
38 }); 38 }
39 });
40 } catch(_) {
41 vscode.window.showWarningMessage('Enhanced typing feature is disabled because of incompatibility with VIM extension');
42 }
39 } 43 }
40 44
41 // Commands are requests from vscode to the language server 45 // Commands are requests from vscode to the language server