diff options
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r-- | editors/code/src/commands/analyzer_status.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index b2b624b75..e680179ae 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | 2 | ||
3 | import { Ctx, Cmd } from '../ctx'; | 3 | import { Ctx, Cmd } from '../ctx'; |
4 | // Shows status of rust-analyzer (for debugging) | ||
5 | 4 | ||
5 | // Shows status of rust-analyzer (for debugging) | ||
6 | export function analyzerStatus(ctx: Ctx): Cmd { | 6 | export function analyzerStatus(ctx: Ctx): Cmd { |
7 | let poller: NodeJS.Timer | null = null; | 7 | let poller: NodeJS.Timer | null = null; |
8 | const tdcp = new TextDocumentContentProvider(ctx); | 8 | const tdcp = new TextDocumentContentProvider(ctx); |
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index e61fb36df..9831c2a2e 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts | |||
@@ -7,12 +7,12 @@ import { Ctx, Cmd } from '../ctx'; | |||
7 | // | 7 | // |
8 | // The contents of the file come from the `TextDocumentContentProvider` | 8 | // The contents of the file come from the `TextDocumentContentProvider` |
9 | export function syntaxTree(ctx: Ctx): Cmd { | 9 | export function syntaxTree(ctx: Ctx): Cmd { |
10 | const stcp = new SyntaxTreeContentProvider(ctx); | 10 | const tdcp = new TextDocumentContentProvider(ctx); |
11 | 11 | ||
12 | ctx.pushCleanup( | 12 | ctx.pushCleanup( |
13 | vscode.workspace.registerTextDocumentContentProvider( | 13 | vscode.workspace.registerTextDocumentContentProvider( |
14 | 'rust-analyzer', | 14 | 'rust-analyzer', |
15 | stcp, | 15 | tdcp, |
16 | ), | 16 | ), |
17 | ); | 17 | ); |
18 | 18 | ||
@@ -20,7 +20,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
20 | (event: vscode.TextDocumentChangeEvent) => { | 20 | (event: vscode.TextDocumentChangeEvent) => { |
21 | const doc = event.document; | 21 | const doc = event.document; |
22 | if (doc.languageId !== 'rust') return; | 22 | if (doc.languageId !== 'rust') return; |
23 | afterLs(() => stcp.eventEmitter.fire(stcp.uri)); | 23 | afterLs(() => tdcp.eventEmitter.fire(tdcp.uri)); |
24 | }, | 24 | }, |
25 | ctx.subscriptions, | 25 | ctx.subscriptions, |
26 | ); | 26 | ); |
@@ -28,7 +28,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
28 | vscode.window.onDidChangeActiveTextEditor( | 28 | vscode.window.onDidChangeActiveTextEditor( |
29 | (editor: vscode.TextEditor | undefined) => { | 29 | (editor: vscode.TextEditor | undefined) => { |
30 | if (!editor || editor.document.languageId !== 'rust') return; | 30 | if (!editor || editor.document.languageId !== 'rust') return; |
31 | stcp.eventEmitter.fire(stcp.uri); | 31 | tdcp.eventEmitter.fire(tdcp.uri); |
32 | }, | 32 | }, |
33 | ctx.subscriptions, | 33 | ctx.subscriptions, |
34 | ); | 34 | ); |
@@ -38,12 +38,12 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
38 | const rangeEnabled = !!(editor && !editor.selection.isEmpty); | 38 | const rangeEnabled = !!(editor && !editor.selection.isEmpty); |
39 | 39 | ||
40 | const uri = rangeEnabled | 40 | const uri = rangeEnabled |
41 | ? vscode.Uri.parse(`${stcp.uri.toString()}?range=true`) | 41 | ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) |
42 | : stcp.uri; | 42 | : tdcp.uri; |
43 | 43 | ||
44 | const document = await vscode.workspace.openTextDocument(uri); | 44 | const document = await vscode.workspace.openTextDocument(uri); |
45 | 45 | ||
46 | stcp.eventEmitter.fire(uri); | 46 | tdcp.eventEmitter.fire(uri); |
47 | 47 | ||
48 | return vscode.window.showTextDocument( | 48 | return vscode.window.showTextDocument( |
49 | document, | 49 | document, |
@@ -64,7 +64,7 @@ interface SyntaxTreeParams { | |||
64 | range?: lc.Range; | 64 | range?: lc.Range; |
65 | } | 65 | } |
66 | 66 | ||
67 | export class SyntaxTreeContentProvider | 67 | class TextDocumentContentProvider |
68 | implements vscode.TextDocumentContentProvider { | 68 | implements vscode.TextDocumentContentProvider { |
69 | ctx: Ctx; | 69 | ctx: Ctx; |
70 | uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); | 70 | uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); |
@@ -86,8 +86,8 @@ export class SyntaxTreeContentProvider | |||
86 | range = editor.selection.isEmpty | 86 | range = editor.selection.isEmpty |
87 | ? undefined | 87 | ? undefined |
88 | : this.ctx.client.code2ProtocolConverter.asRange( | 88 | : this.ctx.client.code2ProtocolConverter.asRange( |
89 | editor.selection, | 89 | editor.selection, |
90 | ); | 90 | ); |
91 | } | 91 | } |
92 | 92 | ||
93 | const request: SyntaxTreeParams = { | 93 | const request: SyntaxTreeParams = { |