about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2019-12-30 20:16:07 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2019-12-30 20:16:07 +0100
commit6cc55e4c5ce994be284fc4337eed21844c0eef24 (patch)
tree608e6434d077bef30e2f5832cb3d8c10d2831305 /editors/code/src
parent7b199f6a4b7a947d1dad6a74b2b88758497d4efa (diff)
downloadrust-6cc55e4c5ce994be284fc4337eed21844c0eef24.tar.gz
rust-6cc55e4c5ce994be284fc4337eed21844c0eef24.zip
status is not a command
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/main.ts12
-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 cf0ddfa1619..d6c210579a2 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
 
 import * as commands from './commands';
 import { HintsUpdater } from './inlay_hints';
-import { StatusDisplay } from './commands/watch_status';
+import { StatusDisplay } from './status_display';
 import * as events from './events';
 import * as notifications from './notifications';
 import { Server } from './server';
@@ -28,10 +28,6 @@ export async function activate(context: vscode.ExtensionContext) {
     ctx.registerCommand('runSingle', commands.runSingle);
     ctx.registerCommand('showReferences', commands.showReferences);
 
-    function disposeOnDeactivation(disposable: vscode.Disposable) {
-        context.subscriptions.push(disposable);
-    }
-
     if (Server.config.enableEnhancedTyping) {
         ctx.overrideCommand('type', commands.onEnter);
     }
@@ -39,7 +35,11 @@ export async function activate(context: vscode.ExtensionContext) {
     const watchStatus = new StatusDisplay(
         Server.config.cargoWatchOptions.command,
     );
-    disposeOnDeactivation(watchStatus);
+    ctx.pushCleanup(watchStatus);
+
+    function disposeOnDeactivation(disposable: vscode.Disposable) {
+        context.subscriptions.push(disposable);
+    }
 
     // Notifications are events triggered by the language server
     const allNotifications: [string, lc.GenericNotificationHandler][] = [
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/status_display.ts
index 10787b5101f..48cf0655be6 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';
 const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
 
 export class StatusDisplay implements vscode.Disposable {
-    public packageName?: string;
+    packageName?: string;
 
     private i = 0;
     private statusBarItem: vscode.StatusBarItem;
@@ -19,7 +19,7 @@ export class StatusDisplay implements vscode.Disposable {
         this.statusBarItem.hide();
     }
 
-    public show() {
+    show() {
         this.packageName = undefined;
 
         this.timer =
@@ -28,18 +28,18 @@ export class StatusDisplay implements vscode.Disposable {
                 if (this.packageName) {
                     this.statusBarItem!.text = `cargo ${this.command} [${
                         this.packageName
-                    }] ${this.frame()}`;
+                        }] ${this.frame()}`;
                 } else {
                     this.statusBarItem!.text = `cargo ${
                         this.command
-                    } ${this.frame()}`;
+                        } ${this.frame()}`;
                 }
             }, 300);
 
         this.statusBarItem.show();
     }
 
-    public hide() {
+    hide() {
         if (this.timer) {
             clearInterval(this.timer);
             this.timer = undefined;
@@ -48,7 +48,7 @@ export class StatusDisplay implements vscode.Disposable {
         this.statusBarItem.hide();
     }
 
-    public dispose() {
+    dispose() {
         if (this.timer) {
             clearInterval(this.timer);
             this.timer = undefined;
@@ -57,7 +57,7 @@ export class StatusDisplay implements vscode.Disposable {
         this.statusBarItem.dispose();
     }
 
-    public handleProgressNotification(params: ProgressParams) {
+    handleProgressNotification(params: ProgressParams) {
         const { token, value } = params;
         if (token !== 'rustAnalyzer/cargoWatcher') {
             return;