Skip to content

Commit

Permalink
Register to vscode-trace-extension as a trace server contributor
Browse files Browse the repository at this point in the history
Activate the extension on the "onStartupFinished" activation event. At
activation, register as a trace server contributor to the
vscode-trace-extension, as the default wildcard contributor by not
providing any isApplicable method implementation.

Signed-off-by: Patrick Tasse <[email protected]>
  • Loading branch information
PatrickTasse committed Feb 2, 2024
1 parent 1272300 commit cb2ce47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"type": "git",
"url": "https://github.com/eclipse-cdt-cloud/vscode-trace-server.git"
},
"activationEvents": [],
"activationEvents": [
"onStartupFinished"
],
"main": "./dist/extension.js",
"extensionKind": [
"workspace"
Expand Down Expand Up @@ -83,5 +85,8 @@
"typescript": "^5.0.4",
"webpack": "^5.81.0",
"webpack-cli": "^5.0.2"
}
},
"extensionDependencies": [
"eclipse-cdt.vscode-trace-extension"
]
}
9 changes: 9 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ const startIfStopped = extensionId + '.start-if-stopped';
let activation: vscode.ExtensionContext;

export function activate(context: vscode.ExtensionContext) {
const vscodeTraceExtension = vscode.extensions.getExtension('eclipse-cdt.vscode-trace-extension');
if (vscodeTraceExtension) {
const api = vscodeTraceExtension.exports;
const contributor = {
startServer: () => server.startIfStopped(context),
stopServer: () => server.stopOrReset(context)
}
api.addTraceServerContributor(contributor);
}
context.subscriptions.push(registerStopOrReset(context));
context.subscriptions.push(registerStartIfStopped(context));
activation = context;
Expand Down

0 comments on commit cb2ce47

Please sign in to comment.