From 0f5d9a03221ec9a4597f3e0bc29f210607713cb4 Mon Sep 17 00:00:00 2001 From: frai Date: Sat, 22 Dec 2018 15:26:18 +0200 Subject: Fix analyzer extension fail when there are enabled any VIM extension. --- editors/code/src/extension.ts | 30 +++++++++++++++++------------- 1 file 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) { const original = (...args: any[]) => vscode.commands.executeCommand(defaultCmd, ...args); - registerCommand(name, async (...args: any[]) => { - const editor = vscode.window.activeTextEditor; - if ( - !editor || - !editor.document || - editor.document.languageId !== 'rust' - ) { - return await original(...args); - } - if (!(await f(...args))) { - return await original(...args); - } - }); + try { + registerCommand(name, async (...args: any[]) => { + const editor = vscode.window.activeTextEditor; + if ( + !editor || + !editor.document || + editor.document.languageId !== 'rust' + ) { + return await original(...args); + } + if (!(await f(...args))) { + return await original(...args); + } + }); + } catch(_) { + vscode.window.showWarningMessage('Enhanced typing feature is disabled because of incompatibility with VIM extension'); + } } // Commands are requests from vscode to the language server -- cgit v1.2.3