Refactor status activation

This commit is contained in:
Aleksey Kladov 2019-12-31 17:22:43 +01:00
parent 1327aed7f6
commit e4b588868f
5 changed files with 36 additions and 43 deletions

View file

@ -1,9 +1,8 @@
import * as vscode from 'vscode';
import * as lc from 'vscode-languageclient';
import * as commands from './commands';
import { activateInlayHints } from './inlay_hints';
import { StatusDisplay } from './status_display';
import { activateStatusDisplay } from './status_display';
import { Server } from './server';
import { Ctx } from './ctx';
import { activateHighlighting } from './highlighting';
@ -32,18 +31,7 @@ export async function activate(context: vscode.ExtensionContext) {
ctx.overrideCommand('type', commands.onEnter);
}
const watchStatus = new StatusDisplay(ctx.config.cargoWatchOptions.command);
ctx.pushCleanup(watchStatus);
// Notifications are events triggered by the language server
const allNotifications: [string, lc.GenericNotificationHandler][] = [
[
'$/progress',
params => watchStatus.handleProgressNotification(params),
],
];
const startServer = () => Server.start(allNotifications);
const startServer = () => Server.start();
const reloadCommand = () => reloadServer(startServer);
vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand);
@ -55,6 +43,7 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.window.showErrorMessage(e.message);
}
activateStatusDisplay(ctx);
activateHighlighting(ctx);
if (ctx.config.displayInlayHints) {