Skip to content

Commit 5fc4471

Browse files
committed
Fix error message after start/stop for missing vscode-trace-extension
Before executing the start or stop command check if the command exists, which is provided by the vscode-trace-extension. Fixes #4 Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
1 parent 794d1fe commit 5fc4471

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/trace-server.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,17 @@ export class TraceServer {
204204
}
205205

206206
private setStatusIfAvailable(started: boolean) {
207-
const fromTraceExtension = 'serverStatus';
208-
if (started) {
209-
vscode.commands.executeCommand(fromTraceExtension + '.started');
210-
} else {
211-
vscode.commands.executeCommand(fromTraceExtension + '.stopped');
212-
}
207+
const commands = vscode.commands.getCommands();
208+
commands.then((commandArray) => {
209+
const fromTraceExtension = 'serverStatus';
210+
const startCommand = fromTraceExtension + '.started';
211+
if (commandArray.findIndex(val => val === (startCommand)) > 0) {
212+
if (started) {
213+
vscode.commands.executeCommand(startCommand);
214+
} else {
215+
vscode.commands.executeCommand(fromTraceExtension + '.stopped');
216+
}
217+
}
218+
});
213219
}
214220
}

0 commit comments

Comments
 (0)