status is not a command

This commit is contained in:
Aleksey Kladov 2019-12-30 20:16:07 +01:00
parent 7b199f6a4b
commit 6cc55e4c5c
2 changed files with 13 additions and 13 deletions

View file

@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
import * as commands from './commands'; import * as commands from './commands';
import { HintsUpdater } from './inlay_hints'; import { HintsUpdater } from './inlay_hints';
import { StatusDisplay } from './commands/watch_status'; import { StatusDisplay } from './status_display';
import * as events from './events'; import * as events from './events';
import * as notifications from './notifications'; import * as notifications from './notifications';
import { Server } from './server'; import { Server } from './server';
@ -28,10 +28,6 @@ export async function activate(context: vscode.ExtensionContext) {
ctx.registerCommand('runSingle', commands.runSingle); ctx.registerCommand('runSingle', commands.runSingle);
ctx.registerCommand('showReferences', commands.showReferences); ctx.registerCommand('showReferences', commands.showReferences);
function disposeOnDeactivation(disposable: vscode.Disposable) {
context.subscriptions.push(disposable);
}
if (Server.config.enableEnhancedTyping) { if (Server.config.enableEnhancedTyping) {
ctx.overrideCommand('type', commands.onEnter); ctx.overrideCommand('type', commands.onEnter);
} }
@ -39,7 +35,11 @@ export async function activate(context: vscode.ExtensionContext) {
const watchStatus = new StatusDisplay( const watchStatus = new StatusDisplay(
Server.config.cargoWatchOptions.command, 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 // Notifications are events triggered by the language server
const allNotifications: [string, lc.GenericNotificationHandler][] = [ const allNotifications: [string, lc.GenericNotificationHandler][] = [

View file

@ -3,7 +3,7 @@ import * as vscode from 'vscode';
const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
export class StatusDisplay implements vscode.Disposable { export class StatusDisplay implements vscode.Disposable {
public packageName?: string; packageName?: string;
private i = 0; private i = 0;
private statusBarItem: vscode.StatusBarItem; private statusBarItem: vscode.StatusBarItem;
@ -19,7 +19,7 @@ export class StatusDisplay implements vscode.Disposable {
this.statusBarItem.hide(); this.statusBarItem.hide();
} }
public show() { show() {
this.packageName = undefined; this.packageName = undefined;
this.timer = this.timer =
@ -28,18 +28,18 @@ export class StatusDisplay implements vscode.Disposable {
if (this.packageName) { if (this.packageName) {
this.statusBarItem!.text = `cargo ${this.command} [${ this.statusBarItem!.text = `cargo ${this.command} [${
this.packageName this.packageName
}] ${this.frame()}`; }] ${this.frame()}`;
} else { } else {
this.statusBarItem!.text = `cargo ${ this.statusBarItem!.text = `cargo ${
this.command this.command
} ${this.frame()}`; } ${this.frame()}`;
} }
}, 300); }, 300);
this.statusBarItem.show(); this.statusBarItem.show();
} }
public hide() { hide() {
if (this.timer) { if (this.timer) {
clearInterval(this.timer); clearInterval(this.timer);
this.timer = undefined; this.timer = undefined;
@ -48,7 +48,7 @@ export class StatusDisplay implements vscode.Disposable {
this.statusBarItem.hide(); this.statusBarItem.hide();
} }
public dispose() { dispose() {
if (this.timer) { if (this.timer) {
clearInterval(this.timer); clearInterval(this.timer);
this.timer = undefined; this.timer = undefined;
@ -57,7 +57,7 @@ export class StatusDisplay implements vscode.Disposable {
this.statusBarItem.dispose(); this.statusBarItem.dispose();
} }
public handleProgressNotification(params: ProgressParams) { handleProgressNotification(params: ProgressParams) {
const { token, value } = params; const { token, value } = params;
if (token !== 'rustAnalyzer/cargoWatcher') { if (token !== 'rustAnalyzer/cargoWatcher') {
return; return;