diff options
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 7218bfb90..2e08e8f11 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts | |||
@@ -2,6 +2,7 @@ import * as vscode from 'vscode'; | |||
2 | import * as ra from '../rust-analyzer-api'; | 2 | import * as ra from '../rust-analyzer-api'; |
3 | 3 | ||
4 | import { Ctx, Cmd } from '../ctx'; | 4 | import { Ctx, Cmd } from '../ctx'; |
5 | import { isRustDocument } from '../util'; | ||
5 | 6 | ||
6 | // Opens the virtual file that will show the syntax tree | 7 | // Opens the virtual file that will show the syntax tree |
7 | // | 8 | // |
@@ -19,7 +20,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
19 | vscode.workspace.onDidChangeTextDocument( | 20 | vscode.workspace.onDidChangeTextDocument( |
20 | (event: vscode.TextDocumentChangeEvent) => { | 21 | (event: vscode.TextDocumentChangeEvent) => { |
21 | const doc = event.document; | 22 | const doc = event.document; |
22 | if (doc.languageId !== 'rust') return; | 23 | if (!isRustDocument(doc)) return; |
23 | afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); | 24 | afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); |
24 | }, | 25 | }, |
25 | null, | 26 | null, |
@@ -28,7 +29,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
28 | 29 | ||
29 | vscode.window.onDidChangeActiveTextEditor( | 30 | vscode.window.onDidChangeActiveTextEditor( |
30 | (editor: vscode.TextEditor | undefined) => { | 31 | (editor: vscode.TextEditor | undefined) => { |
31 | if (!editor || editor.document.languageId !== 'rust') return; | 32 | if (!editor || !isRustDocument(editor.document)) return; |
32 | tdcp.eventEmitter.fire(tdcp.uri); | 33 | tdcp.eventEmitter.fire(tdcp.uri); |
33 | }, | 34 | }, |
34 | null, | 35 | null, |