diff options
Diffstat (limited to 'editors/code/src/commands/analyzer_status.ts')
-rw-r--r-- | editors/code/src/commands/analyzer_status.ts | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index c9d32fe07..b2b624b75 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | |||
2 | import { Ctx, Cmd } from '../ctx'; | 3 | import { Ctx, Cmd } from '../ctx'; |
3 | // Shows status of rust-analyzer (for debugging) | 4 | // Shows status of rust-analyzer (for debugging) |
4 | 5 | ||
@@ -23,10 +24,7 @@ export function analyzerStatus(ctx: Ctx): Cmd { | |||
23 | 24 | ||
24 | return async function handle() { | 25 | return async function handle() { |
25 | if (poller == null) { | 26 | if (poller == null) { |
26 | poller = setInterval( | 27 | poller = setInterval(() => tdcp.eventEmitter.fire(tdcp.uri), 1000); |
27 | () => tdcp.eventEmitter.fire(tdcp.uri), | ||
28 | 1000, | ||
29 | ); | ||
30 | } | 28 | } |
31 | const document = await vscode.workspace.openTextDocument(tdcp.uri); | 29 | const document = await vscode.workspace.openTextDocument(tdcp.uri); |
32 | return vscode.window.showTextDocument( | 30 | return vscode.window.showTextDocument( |
@@ -39,23 +37,20 @@ export function analyzerStatus(ctx: Ctx): Cmd { | |||
39 | 37 | ||
40 | class TextDocumentContentProvider | 38 | class TextDocumentContentProvider |
41 | implements vscode.TextDocumentContentProvider { | 39 | implements vscode.TextDocumentContentProvider { |
42 | 40 | ctx: Ctx; | |
43 | uri = vscode.Uri.parse('rust-analyzer-status://status'); | 41 | uri = vscode.Uri.parse('rust-analyzer-status://status'); |
44 | eventEmitter = new vscode.EventEmitter<vscode.Uri>(); | 42 | eventEmitter = new vscode.EventEmitter<vscode.Uri>(); |
45 | 43 | ||
46 | ctx: Ctx | ||
47 | |||
48 | constructor(ctx: Ctx) { | 44 | constructor(ctx: Ctx) { |
49 | this.ctx = ctx | 45 | this.ctx = ctx; |
50 | } | 46 | } |
51 | 47 | ||
52 | provideTextDocumentContent( | 48 | provideTextDocumentContent( |
53 | _uri: vscode.Uri, | 49 | _uri: vscode.Uri, |
54 | ): vscode.ProviderResult<string> { | 50 | ): vscode.ProviderResult<string> { |
55 | const editor = vscode.window.activeTextEditor; | 51 | const editor = vscode.window.activeTextEditor; |
56 | if (editor == null) { | 52 | if (editor == null) return ''; |
57 | return ''; | 53 | |
58 | } | ||
59 | return this.ctx.client.sendRequest<string>( | 54 | return this.ctx.client.sendRequest<string>( |
60 | 'rust-analyzer/analyzerStatus', | 55 | 'rust-analyzer/analyzerStatus', |
61 | null, | 56 | null, |