Encapsulate highlighting activation

This commit is contained in:
Aleksey Kladov 2019-12-30 20:29:21 +01:00
parent 17dda0972a
commit 7646dc046e
4 changed files with 24 additions and 35 deletions

View file

@ -4,10 +4,10 @@ import * as lc from 'vscode-languageclient';
import * as commands from './commands';
import { activateInlayHints } from './inlay_hints';
import { StatusDisplay } from './status_display';
import * as events from './events';
import * as notifications from './notifications';
import { Server } from './server';
import { Ctx } from './ctx';
import { activateHighlighting } from './highlighting';
let ctx!: Ctx;
@ -37,6 +37,8 @@ export async function activate(context: vscode.ExtensionContext) {
);
ctx.pushCleanup(watchStatus);
activateHighlighting(ctx);
// Notifications are events triggered by the language server
const allNotifications: [string, lc.GenericNotificationHandler][] = [
[
@ -49,11 +51,6 @@ export async function activate(context: vscode.ExtensionContext) {
],
];
// The events below are plain old javascript events, triggered and handled by vscode
vscode.window.onDidChangeActiveTextEditor(
events.changeActiveTextEditor.makeHandler(),
);
const startServer = () => Server.start(allNotifications);
const reloadCommand = () => reloadServer(startServer);