Fix VSCode extension hanging (#15407)

This commit is contained in:
Alistair Smith
2024-11-25 12:43:46 -08:00
committed by GitHub
parent 7f6bb30877
commit 39af2a0a56
8 changed files with 120 additions and 33 deletions

View File

@@ -294,7 +294,7 @@ export abstract class BaseDebugAdapter<T extends Inspector = Inspector>
/**
* Gets the inspector url. This is deprecated and exists for compat.
* @deprecated You should get the inspector directly, and if it's a WebSocketInspector you can access `.url` direclty.
* @deprecated You should get the inspector directly (with .getInspector()), and if it's a WebSocketInspector you can access `.url` direclty.
*/
get url(): string {
// This code has been migrated from a time when the inspector was always a WebSocketInspector.
@@ -305,6 +305,10 @@ export abstract class BaseDebugAdapter<T extends Inspector = Inspector>
throw new Error("Inspector does not offer a URL");
}
public getInspector() {
return this.inspector;
}
abstract start(...args: unknown[]): Promise<boolean>;
/**
@@ -2064,7 +2068,7 @@ export class NodeSocketDebugAdapter extends BaseDebugAdapter<NodeSocketInspector
/**
* The default debug adapter. Connects via WebSocket
*/
export class DebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
export class WebSocketDebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
#process?: ChildProcess;
public constructor(url?: string | URL, untitledDocPath?: string, bunEvalPath?: string) {
@@ -2331,6 +2335,8 @@ export class DebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
}
}
export const DebugAdapter = WebSocketDebugAdapter;
function stoppedReason(reason: JSC.Debugger.PausedEvent["reason"]): DAP.StoppedEvent["reason"] {
switch (reason) {
case "Breakpoint":