Skip to content

Commit bd538d7

Browse files
committed
Register to vscode-trace-extension as a trace server contributor
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]>
1 parent 1272300 commit bd538d7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"type": "git",
1616
"url": "https://github.com/eclipse-cdt-cloud/vscode-trace-server.git"
1717
},
18-
"activationEvents": [],
18+
"activationEvents": [
19+
"onStartupFinished"
20+
],
1921
"main": "./dist/extension.js",
2022
"extensionKind": [
2123
"workspace"
@@ -83,5 +85,8 @@
8385
"typescript": "^5.0.4",
8486
"webpack": "^5.81.0",
8587
"webpack-cli": "^5.0.2"
86-
}
88+
},
89+
"extensionDependencies": [
90+
"eclipse-cdt.vscode-trace-extension"
91+
]
8792
}

src/extension.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ const startIfStopped = extensionId + '.start-if-stopped';
99
let activation: vscode.ExtensionContext;
1010

1111
export function activate(context: vscode.ExtensionContext) {
12+
const vscodeTraceExtension = vscode.extensions.getExtension('eclipse-cdt.vscode-trace-extension');
13+
if (vscodeTraceExtension) {
14+
const api = vscodeTraceExtension.exports;
15+
const contributor = {
16+
startServer: () => server.startIfStopped(context),
17+
stopServer: () => server.stopOrReset(context)
18+
}
19+
api.addTraceServerContributor(contributor);
20+
}
1221
context.subscriptions.push(registerStopOrReset(context));
1322
context.subscriptions.push(registerStartIfStopped(context));
1423
activation = context;

0 commit comments

Comments
 (0)