Skip to content

Commit d712115

Browse files
committed
Support terminateThreads
1 parent c7280b6 commit d712115

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/phpDebug.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class PhpDebugSession extends vscode.DebugSession {
179179
default: true,
180180
},
181181
],
182+
supportsTerminateThreadsRequest: true,
182183
}
183184
this.sendResponse(response)
184185
}
@@ -983,6 +984,28 @@ class PhpDebugSession extends vscode.DebugSession {
983984
this.sendErrorResponse(response, new Error('Pausing the execution is not supported by XDebug'))
984985
}
985986

987+
protected async terminateThreadsRequest(response: VSCodeDebugProtocol.TerminateThreadsResponse, args: VSCodeDebugProtocol.TerminateThreadsArguments) {
988+
try {
989+
if (args.threadIds) {
990+
await Promise.all(
991+
args.threadIds.map(async (threadId) => {
992+
const connection = this._connections.get(threadId)
993+
if (connection) {
994+
await Promise.race([connection.sendStopCommand(), new Promise(resolve => setTimeout(resolve, 500))])
995+
await connection.close()
996+
this._connections.delete(threadId)
997+
this._waitingConnections.delete(connection)
998+
}
999+
})
1000+
)
1001+
}
1002+
this.sendResponse(response)
1003+
} catch (error) {
1004+
this.sendErrorResponse(response, error)
1005+
return
1006+
}
1007+
}
1008+
9861009
protected async disconnectRequest(
9871010
response: VSCodeDebugProtocol.DisconnectResponse,
9881011
args: VSCodeDebugProtocol.DisconnectArguments

0 commit comments

Comments
 (0)