From e53ccb6e99bb0e92ebea19f150c8fbf9b6958634 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Dec 2019 14:42:59 +0100 Subject: Start new ctx module --- editors/code/src/main.ts | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'editors/code/src/main.ts') diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 1da10ebd0..048b9bbd4 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -9,8 +9,18 @@ import { StatusDisplay } from './commands/watch_status'; import * as events from './events'; import * as notifications from './notifications'; import { Server } from './server'; +import { Ctx } from './ctx' + +let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { + ctx = new Ctx(context); + ctx.registerCommand( + 'analyzerStatus', + commands.analyzerStatus + ); + + function disposeOnDeactivation(disposable: vscode.Disposable) { context.subscriptions.push(disposable); } @@ -48,10 +58,6 @@ export async function activate(context: vscode.ExtensionContext) { } // Commands are requests from vscode to the language server - registerCommand( - 'rust-analyzer.analyzerStatus', - commands.analyzerStatus.makeCommand(context), - ); registerCommand('rust-analyzer.collectGarbage', () => Server.client.sendRequest('rust-analyzer/collectGarbage', null), ); @@ -94,15 +100,15 @@ export async function activate(context: vscode.ExtensionContext) { string, lc.GenericNotificationHandler, ]> = [ - [ - 'rust-analyzer/publishDecorations', - notifications.publishDecorations.handle, - ], - [ - '$/progress', - params => watchStatus.handleProgressNotification(params), - ], - ]; + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle, + ], + [ + '$/progress', + params => watchStatus.handleProgressNotification(params), + ], + ]; const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider(); -- cgit v1.2.3