From 65e254a3d0932ece074b106e112f9f86b06e8bf2 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Mon, 12 Aug 2024 22:01:45 +0100 Subject: [PATCH 1/2] Allow specifying debugSocketPath for attach requests --- vscode/package.json | 9 ++++++++- vscode/src/debugger.ts | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/vscode/package.json b/vscode/package.json index ffaf4a038..4cd702838 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -469,7 +469,14 @@ } } }, - "attach": {} + "attach": { + "properties": { + "debugSocketPath": { + "type": "string", + "description": "The path to the debug socket. This is used to connect to the debugger" + } + } + } }, "configurationSnippets": [ { diff --git a/vscode/src/debugger.ts b/vscode/src/debugger.ts index 7d6724747..9acd5007c 100644 --- a/vscode/src/debugger.ts +++ b/vscode/src/debugger.ts @@ -161,6 +161,13 @@ export class Debugger private async getSockets(session: vscode.DebugSession) { const configuration = session.configuration; + + const debugSocketPath = session.configuration.debugSocketPath; + + if (debugSocketPath) { + return [debugSocketPath]; + } + let sockets: string[] = []; try { From 3004872f649985a3fb81f6e02cbff01b14c2e1a4 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Mon, 12 Aug 2024 22:27:13 +0100 Subject: [PATCH 2/2] Support attaching to debugger with host and port --- vscode/package.json | 8 ++++++++ vscode/src/debugger.ts | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/vscode/package.json b/vscode/package.json index 4cd702838..af6b81988 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -474,6 +474,14 @@ "debugSocketPath": { "type": "string", "description": "The path to the debug socket. This is used to connect to the debugger" + }, + "debugPort": { + "type": "number", + "description": "The port to use to connect to the debugger" + }, + "debugHost": { + "type": "string", + "description": "The host to use to connect to the debugger" } } } diff --git a/vscode/src/debugger.ts b/vscode/src/debugger.ts index 9acd5007c..12e7547dc 100644 --- a/vscode/src/debugger.ts +++ b/vscode/src/debugger.ts @@ -189,6 +189,18 @@ export class Debugger private async attachDebuggee( session: vscode.DebugSession, ): Promise { + const debugPort = session.configuration.debugPort; + + if (debugPort) { + const debugHost = session.configuration.debugHost; + + if (debugHost) { + return new vscode.DebugAdapterServer(debugPort, debugHost); + } + + return new vscode.DebugAdapterServer(debugPort); + } + // When using attach, a process will be launched using Ruby debug and it will create a socket automatically. We have // to find the available sockets and ask the user which one they want to attach to const sockets = await this.getSockets(session);