Re-format VSCode extension changes

This commit is contained in:
Emil Lauridsen 2019-12-25 19:10:30 +01:00
parent 178c23f505
commit b9c10ed97f
2 changed files with 20 additions and 19 deletions

View file

@ -59,23 +59,22 @@ export class StatusDisplay implements vscode.Disposable {
public handleProgressNotification(params: ProgressParams) { public handleProgressNotification(params: ProgressParams) {
const { token, value } = params; const { token, value } = params;
if (token !== "rustAnalyzer/cargoWatcher") { if (token !== 'rustAnalyzer/cargoWatcher') {
return; return;
} }
console.log("Got progress notification", token, value)
switch (value.kind) { switch (value.kind) {
case "begin": case 'begin':
this.show(); this.show();
break; break;
case "report": case 'report':
if (value.message) { if (value.message) {
this.packageName = value.message; this.packageName = value.message;
} }
break; break;
case "end": case 'end':
this.hide(); this.hide();
break; break;
} }
@ -88,19 +87,19 @@ export class StatusDisplay implements vscode.Disposable {
// FIXME: Replace this once vscode-languageclient is updated to LSP 3.15 // FIXME: Replace this once vscode-languageclient is updated to LSP 3.15
interface ProgressParams { interface ProgressParams {
token: string token: string;
value: WorkDoneProgress value: WorkDoneProgress;
} }
enum WorkDoneProgressKind { enum WorkDoneProgressKind {
Begin = "begin", Begin = 'begin',
Report = "report", Report = 'report',
End = "end" End = 'end',
} }
interface WorkDoneProgress { interface WorkDoneProgress {
kind: WorkDoneProgressKind, kind: WorkDoneProgressKind;
message?: string message?: string;
cancelable?: boolean cancelable?: boolean;
percentage?: string percentage?: string;
} }

View file

@ -5,10 +5,10 @@ import * as commands from './commands';
import { ExpandMacroContentProvider } from './commands/expand_macro'; import { ExpandMacroContentProvider } from './commands/expand_macro';
import { HintsUpdater } from './commands/inlay_hints'; import { HintsUpdater } from './commands/inlay_hints';
import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import { SyntaxTreeContentProvider } from './commands/syntaxTree';
import { StatusDisplay } from './commands/watch_status';
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';
import { StatusDisplay } from './commands/watch_status';
export async function activate(context: vscode.ExtensionContext) { export async function activate(context: vscode.ExtensionContext) {
function disposeOnDeactivation(disposable: vscode.Disposable) { function disposeOnDeactivation(disposable: vscode.Disposable) {
@ -84,7 +84,9 @@ export async function activate(context: vscode.ExtensionContext) {
overrideCommand('type', commands.onEnter.handle); overrideCommand('type', commands.onEnter.handle);
} }
const watchStatus = new StatusDisplay(Server.config.cargoCheckOptions.command || 'check'); const watchStatus = new StatusDisplay(
Server.config.cargoCheckOptions.command || 'check',
);
disposeOnDeactivation(watchStatus); disposeOnDeactivation(watchStatus);
// Notifications are events triggered by the language server // Notifications are events triggered by the language server
@ -98,8 +100,8 @@ export async function activate(context: vscode.ExtensionContext) {
], ],
[ [
'$/progress', '$/progress',
(params) => watchStatus.handleProgressNotification(params), params => watchStatus.handleProgressNotification(params),
] ],
]; ];
const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
const expandMacroContentProvider = new ExpandMacroContentProvider(); const expandMacroContentProvider = new ExpandMacroContentProvider();