-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider to support a server mode for debug adapters #22080
Comments
Oh, I didn't realize |
There are some limitations on server mode in its current form. 1) It has a fixed port number which will not allow two vscode instances to run the same debugger at the same time. 2) It does not allow an extension to run a prepare code for instance to find an available port or init debugger. |
@daviwil no, |
|
@daviwil I think that would work. Try it out :) |
Had been planning to, just didn't get around to it yet :) I'm finally at the point now with my extension where using |
@gorkem the "fixed port" is configurable, so there is no problem running multiple instances of the same debugger. |
@weinand Is this a configuration per instance or per installation? Is it possible for a bit of code to be executed to calculate the next available port? |
@gorkem You are in control of the configuration. So it can be anything you like. I've just prototyped this for your case. In your extension you can register a hook for the 'startSession' event, which is triggered when a new debug session is launched. In this hook you determine the port on which the java debug adapter listens (or you can even start the debug adapter there). Then you assign the port number to the Here is the complete extension code that goes into the context.subscriptions.push(vscode.commands.registerCommand('extension.java.startSession', config => {
if (!config.debugServer) {
config.debugServer = 12345; // determine debug port
}
vscode.commands.executeCommand('vscode.startDebug', config);
}); In the package.json you need these contributions: "activationEvents": [
// ...
"onCommand:extension.java.startSession"
// ...
],
"contributes": {
"debuggers": [
{
"type": "java",
// ...
"startSessionCommand": "extension.java.startSession"
// ...
}
]
} |
I do not see a need for anything else at the moment. |
Today VS Code starts a new debug adapter process for every debug session.
Only in "debug adapter development mode" we support to have a debug adapter running as a server and to have VS Code just connect to it for a debug session.
We should consider to make the "server mode" an official run option for debug adapters.
/cc @isidorn @daviwil
The text was updated successfully, but these errors were encountered: