From dcdbbddd1630a4ed01906c2aff0e2b65ed99a591 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 12:17:01 +0100 Subject: Simplify TS reload logic Fixes #3164 --- editors/code/src/highlighting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code/src/highlighting.ts') diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 4fbbe3ddc..f693fb8ba 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -7,7 +7,7 @@ import { Ctx, sendRequestWithRetry } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - ctx.onDidRestart(client => { + ctx.onStart(client => { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { -- cgit v1.2.3 From d24e612106867c4bb6a1e59bf99aabfb7bc27823 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 13:40:20 +0100 Subject: Simplify startup --- editors/code/src/highlighting.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'editors/code/src/highlighting.ts') diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index f693fb8ba..a2db04de8 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -7,7 +7,8 @@ import { Ctx, sendRequestWithRetry } from './ctx'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); - ctx.onStart(client => { + const client = ctx.client; + if (client != null) { client.onNotification( 'rust-analyzer/publishDecorations', (params: PublishDecorationsParams) => { @@ -28,7 +29,7 @@ export function activateHighlighting(ctx: Ctx) { highlighter.setHighlights(targetEditor, params.decorations); }, ); - }); + }; vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), -- cgit v1.2.3