Fix breakpoint on entry for extension

This commit is contained in:
Ashcon Partovi
2023-09-01 10:19:14 -07:00
parent 1ff8155c28
commit 2b421be06f
5 changed files with 15 additions and 18 deletions

View File

@@ -449,6 +449,7 @@ export class DebugAdapter extends EventEmitter<DebugAdapterEventMap> implements
env = {},
strictEnv = false,
watchMode = false,
stopOnEntry = false,
} = request;
if (!program) {
@@ -489,10 +490,8 @@ export class DebugAdapter extends EventEmitter<DebugAdapterEventMap> implements
signal.close();
});
// Break on entry is always set so the debugger has a chance
// to set breakpoints before the program starts. If `stopOnEntry`
// was not set, then the debugger will auto-continue after the first pause.
processEnv["BUN_INSPECT"] = `${url}?break=1`;
const query = stopOnEntry ? "break=1" : "wait=1";
processEnv["BUN_INSPECT"] = `${url}?${query}`;
processEnv["BUN_INSPECT_NOTIFY"] = signal.url;
// This is probably not correct, but it's the best we can do for now.

View File

@@ -8,7 +8,7 @@ export default {
};
const coolThing: CoolThing = new SuperCoolThing();
coolThing.doCoolThing();
return new Response("Hello World");
return new Response("Hello World??");
},
};

View File

@@ -0,0 +1,8 @@
console.log("HELLO");
console.log("HELLO 2");
console.log("HELLO 3");
a();
function a() {
console.log("HELLO 4");
}

View File

@@ -242,18 +242,10 @@
],
"priority": "default"
}
],
"terminal": {
"profiles": [
{
"title": "Bun Terminal",
"id": "bun"
}
]
}
]
},
"description": "The Visual Studio Code extension for Bun.",
"displayName": "Bun",
"displayName": "Bun for Visual Studio Code",
"engines": {
"vscode": "^1.81.0"
},
@@ -284,7 +276,6 @@
},
"workspaces": [
"../bun-debug-adapter-protocol",
"../bun-inspector-protocol",
"../bun-wasm"
"../bun-inspector-protocol"
]
}

View File

@@ -46,7 +46,6 @@ export default function (context: vscode.ExtensionContext, factory?: vscode.Debu
vscode.DebugConfigurationProviderTriggerKind.Dynamic,
),
vscode.debug.registerDebugAdapterDescriptorFactory("bun", factory ?? new InlineDebugAdapterFactory()),
vscode.window.registerTerminalProfileProvider("bun", new TerminalProfileProvider()),
vscode.window.onDidOpenTerminal(InjectDebugTerminal),
);
}