Skip to content

Commit 26192e5

Browse files
committed
fix: Startup binary to set up dynamically
1 parent 2297da4 commit 26192e5

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,26 @@
2626
"codetracer.runnablePath": {
2727
"type": "string",
2828
"default": "",
29-
"description": "Path to the CodeTracer AppImage"
29+
"description": "Path to the CodeTracer binary"
3030
}
3131
}
3232
},
3333
"debuggers": [
3434
{
3535
"type": "codetracer-debug",
3636
"label": "Codetracer Debugger",
37-
"program": "/home/nedy/codetracer-vscode-extension/libs/codetracer/result/bin/ct",
38-
"args": [
39-
"start_backend",
40-
"db",
41-
"--stdio"
42-
],
4337
"configurationAttributes": {
4438
"launch": {
4539
"required": [
46-
"program"
40+
"program",
41+
"traceFolder"
4742
],
4843
"properties": {
4944
"program": {
45+
"type": "string",
46+
"description": "Path to executable"
47+
},
48+
"traceFolder": {
5049
"type": "string",
5150
"description": "Path to the trace folder containing .json files"
5251
}

src/extension.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ async function toggleCt(context: vscode.ExtensionContext, dapVsCodeApi: DapVsCod
178178
type: "codetracer-debug",
179179
request: "launch",
180180
name: "Launch Codetracer",
181-
program: codetracerExe,
182181
cwd: "",
183182
traceFolder: selectedFile
184183
};
@@ -249,6 +248,21 @@ async function reinitCommands(context: vscode.ExtensionContext) {
249248
}
250249
}
251250

251+
// Set the codetracer executable and the args
252+
context.subscriptions.push(
253+
vscode.debug.registerDebugAdapterDescriptorFactory(
254+
"codetracer-debug",
255+
new (class implements vscode.DebugAdapterDescriptorFactory {
256+
async createDebugAdapterDescriptor(session: vscode.DebugSession) {
257+
if (codetracerExe) {
258+
const args = ["start_backend", "db", "--stdio"];
259+
return new vscode.DebugAdapterExecutable(codetracerExe, args, {});
260+
}
261+
}
262+
})
263+
)
264+
);
265+
252266
const register = (id: string, fn: (...a: any[]) => any) =>
253267
commandDisposables.push(vscode.commands.registerCommand(id, fn));
254268

0 commit comments

Comments
 (0)