Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export function deactivate() {
}

function registerStopOrReset(context: vscode.ExtensionContext | undefined): vscode.Disposable {
return vscode.commands.registerCommand(stopOrReset, () => {
return server.stopOrReset(context);
return vscode.commands.registerCommand(stopOrReset, async () => {
await server.stopOrReset(context);
});
}
export const registerStopOrReset_test = registerStopOrReset;

function registerStartIfStopped(context: vscode.ExtensionContext | undefined): vscode.Disposable {
return vscode.commands.registerCommand(startIfStopped, () => {
server.startIfStopped(context);
return vscode.commands.registerCommand(startIfStopped, async () => {
await server.startIfStopped(context);
});
}
export const registerStartIfStopped_test = registerStartIfStopped;
20 changes: 10 additions & 10 deletions src/trace-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const suffix = ' failure or so.';
export class TraceServer {
private server: ChildProcess | undefined;

private start(context: vscode.ExtensionContext | undefined) {
private async start(context: vscode.ExtensionContext | undefined) {
const from = this.getSettings();
const server = spawn(this.getPath(from), this.getArgs(from));

Expand All @@ -26,8 +26,8 @@ export class TraceServer {
return;
}
this.server = server;
context?.workspaceState.update(key, this.server.pid);
this.waitFor(context);
await context?.workspaceState.update(key, this.server.pid);
await this.waitFor(context);
}

async stopOrReset(context: vscode.ExtensionContext | undefined) {
Expand All @@ -46,7 +46,7 @@ export class TraceServer {
clearTimeout(id);
});
}
vscode.window.withProgress(
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Notification,
title: prefix,
Expand All @@ -67,7 +67,7 @@ export class TraceServer {
} else {
vscode.window.showWarningMessage(not);
}
context?.workspaceState.update(key, none);
await context?.workspaceState.update(key, none);
this.server = undefined;
}

Expand All @@ -77,14 +77,14 @@ export class TraceServer {
const foreigner = await this.isUp();

if (stopped && !foreigner) {
this.start(context);
await this.start(context);
} else if (foreigner) {
vscode.window.showWarningMessage(prefix + ' not started as already running.');
} else {
// Not UP but there is still a pid stored.
// Likely because Codium or so exited without one using the stop command prior.
context?.workspaceState.update(key, none);
this.start(context);
await context?.workspaceState.update(key, none);
await this.start(context);
}
}

Expand Down Expand Up @@ -139,7 +139,7 @@ export class TraceServer {
}

private async waitFor(context: vscode.ExtensionContext | undefined) {
vscode.window.withProgress(
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Notification,
title: prefix,
Expand All @@ -159,7 +159,7 @@ export class TraceServer {
}
if (timeout) {
this.showError(prefix + ' startup timed-out after ' + millis + 'ms.');
this.stopOrReset(context);
await this.stopOrReset(context);
break;
}
}
Expand Down