diff options
author | Aleksey Kladov <[email protected]> | 2019-12-30 19:16:07 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-30 19:16:07 +0000 |
commit | 6cc55e4c5ce994be284fc4337eed21844c0eef24 (patch) | |
tree | 608e6434d077bef30e2f5832cb3d8c10d2831305 /editors | |
parent | 7b199f6a4b7a947d1dad6a74b2b88758497d4efa (diff) |
status is not a command
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/main.ts | 12 | ||||
-rw-r--r-- | editors/code/src/status_display.ts (renamed from editors/code/src/commands/watch_status.ts) | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index cf0ddfa16..d6c210579 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient'; | |||
3 | 3 | ||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { HintsUpdater } from './inlay_hints'; | 5 | import { HintsUpdater } from './inlay_hints'; |
6 | import { StatusDisplay } from './commands/watch_status'; | 6 | import { StatusDisplay } from './status_display'; |
7 | import * as events from './events'; | 7 | import * as events from './events'; |
8 | import * as notifications from './notifications'; | 8 | import * as notifications from './notifications'; |
9 | import { Server } from './server'; | 9 | import { Server } from './server'; |
@@ -28,10 +28,6 @@ export async function activate(context: vscode.ExtensionContext) { | |||
28 | ctx.registerCommand('runSingle', commands.runSingle); | 28 | ctx.registerCommand('runSingle', commands.runSingle); |
29 | ctx.registerCommand('showReferences', commands.showReferences); | 29 | ctx.registerCommand('showReferences', commands.showReferences); |
30 | 30 | ||
31 | function disposeOnDeactivation(disposable: vscode.Disposable) { | ||
32 | context.subscriptions.push(disposable); | ||
33 | } | ||
34 | |||
35 | if (Server.config.enableEnhancedTyping) { | 31 | if (Server.config.enableEnhancedTyping) { |
36 | ctx.overrideCommand('type', commands.onEnter); | 32 | ctx.overrideCommand('type', commands.onEnter); |
37 | } | 33 | } |
@@ -39,7 +35,11 @@ export async function activate(context: vscode.ExtensionContext) { | |||
39 | const watchStatus = new StatusDisplay( | 35 | const watchStatus = new StatusDisplay( |
40 | Server.config.cargoWatchOptions.command, | 36 | Server.config.cargoWatchOptions.command, |
41 | ); | 37 | ); |
42 | disposeOnDeactivation(watchStatus); | 38 | ctx.pushCleanup(watchStatus); |
39 | |||
40 | function disposeOnDeactivation(disposable: vscode.Disposable) { | ||
41 | context.subscriptions.push(disposable); | ||
42 | } | ||
43 | 43 | ||
44 | // Notifications are events triggered by the language server | 44 | // Notifications are events triggered by the language server |
45 | const allNotifications: [string, lc.GenericNotificationHandler][] = [ | 45 | const allNotifications: [string, lc.GenericNotificationHandler][] = [ |
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/status_display.ts index 10787b510..48cf0655b 100644 --- a/editors/code/src/commands/watch_status.ts +++ b/editors/code/src/status_display.ts | |||
@@ -3,7 +3,7 @@ import * as vscode from 'vscode'; | |||
3 | const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; | 3 | const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; |
4 | 4 | ||
5 | export class StatusDisplay implements vscode.Disposable { | 5 | export class StatusDisplay implements vscode.Disposable { |
6 | public packageName?: string; | 6 | packageName?: string; |
7 | 7 | ||
8 | private i = 0; | 8 | private i = 0; |
9 | private statusBarItem: vscode.StatusBarItem; | 9 | private statusBarItem: vscode.StatusBarItem; |
@@ -19,7 +19,7 @@ export class StatusDisplay implements vscode.Disposable { | |||
19 | this.statusBarItem.hide(); | 19 | this.statusBarItem.hide(); |
20 | } | 20 | } |
21 | 21 | ||
22 | public show() { | 22 | show() { |
23 | this.packageName = undefined; | 23 | this.packageName = undefined; |
24 | 24 | ||
25 | this.timer = | 25 | this.timer = |
@@ -28,18 +28,18 @@ export class StatusDisplay implements vscode.Disposable { | |||
28 | if (this.packageName) { | 28 | if (this.packageName) { |
29 | this.statusBarItem!.text = `cargo ${this.command} [${ | 29 | this.statusBarItem!.text = `cargo ${this.command} [${ |
30 | this.packageName | 30 | this.packageName |
31 | }] ${this.frame()}`; | 31 | }] ${this.frame()}`; |
32 | } else { | 32 | } else { |
33 | this.statusBarItem!.text = `cargo ${ | 33 | this.statusBarItem!.text = `cargo ${ |
34 | this.command | 34 | this.command |
35 | } ${this.frame()}`; | 35 | } ${this.frame()}`; |
36 | } | 36 | } |
37 | }, 300); | 37 | }, 300); |
38 | 38 | ||
39 | this.statusBarItem.show(); | 39 | this.statusBarItem.show(); |
40 | } | 40 | } |
41 | 41 | ||
42 | public hide() { | 42 | hide() { |
43 | if (this.timer) { | 43 | if (this.timer) { |
44 | clearInterval(this.timer); | 44 | clearInterval(this.timer); |
45 | this.timer = undefined; | 45 | this.timer = undefined; |
@@ -48,7 +48,7 @@ export class StatusDisplay implements vscode.Disposable { | |||
48 | this.statusBarItem.hide(); | 48 | this.statusBarItem.hide(); |
49 | } | 49 | } |
50 | 50 | ||
51 | public dispose() { | 51 | dispose() { |
52 | if (this.timer) { | 52 | if (this.timer) { |
53 | clearInterval(this.timer); | 53 | clearInterval(this.timer); |
54 | this.timer = undefined; | 54 | this.timer = undefined; |
@@ -57,7 +57,7 @@ export class StatusDisplay implements vscode.Disposable { | |||
57 | this.statusBarItem.dispose(); | 57 | this.statusBarItem.dispose(); |
58 | } | 58 | } |
59 | 59 | ||
60 | public handleProgressNotification(params: ProgressParams) { | 60 | handleProgressNotification(params: ProgressParams) { |
61 | const { token, value } = params; | 61 | const { token, value } = params; |
62 | if (token !== 'rustAnalyzer/cargoWatcher') { | 62 | if (token !== 'rustAnalyzer/cargoWatcher') { |
63 | return; | 63 | return; |