From 2f54c1d653d46831eeb7d691c5f25b78ca63378a Mon Sep 17 00:00:00 2001 From: Julien Roncaglia Date: Mon, 2 Mar 2020 22:54:29 +0100 Subject: Centralize the check for languageId on document Also move visibleRustEditors to Ctx --- editors/code/src/highlighting.ts | 4 ++-- 1 file changed, 2 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 3e0cbdc56..036183834 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -4,7 +4,7 @@ import * as ra from './rust-analyzer-api'; import { ColorTheme, TextMateRuleSettings } from './color_theme'; import { Ctx } from './ctx'; -import { sendRequestWithRetry } from './util'; +import { sendRequestWithRetry, isRustDocument } from './util'; export function activateHighlighting(ctx: Ctx) { const highlighter = new Highlighter(ctx); @@ -36,7 +36,7 @@ export function activateHighlighting(ctx: Ctx) { vscode.window.onDidChangeActiveTextEditor( async (editor: vscode.TextEditor | undefined) => { - if (!editor || editor.document.languageId !== 'rust') return; + if (!editor || !isRustDocument(editor.document)) return; if (!ctx.config.highlightingOn) return; const client = ctx.client; if (!client) return; -- cgit v1.2.3