mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Centralize the check for languageId on document
Also move visibleRustEditors to Ctx
This commit is contained in:
parent
b95756d21b
commit
2f54c1d653
5 changed files with 25 additions and 24 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue