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
How vscode knows about the server port no of debug adapter when it itself starts debug adapter ? #54173
Comments
(Experimental duplicate detection) |
@tarunbansal11 in the second case VS Code talks to DA via stdin/stdout, it doesn't use a port. See https://code.visualstudio.com/docs/extensions/example-debuggers |
We have a great developer community over on slack where extension authors help each other. This is a great place for you to ask questions and find support. Happy Coding! |
Thanks @weinand. I saw the code of mock debugger extension. In the first case, debugger adapter is started with --server =4711 and we mention this port no (4711) in "debugServer" in launch.json. |
It is very simple to support both modes from the same DA executable. For instance if you are basing your DA on the vscode-debugadapter node module, then the resulting DA supports both modes automatically: if the DA is launched without arguments then it communicates via stdin/stdout. If an argument The code from the vscode-debugadapter node module for both cases is here: The socket mode is very helpful for debugging the DA: you can just run the DA as a server inside the debugger and VS Code will connect to it instead of always a launching a new instance of the DA. |
Now I see, thank you very much @weinand for your quick resolving my doubt. One suggestion - It would be nice if this information (i.e. in the second case VS Code talks to DA via stdin/stdout, it doesn't use a port) is documented somewhere though there is a high probability that It is already documented and I missed it. |
As I know, there are following two ways to run debug adapter. My confusion lies in the second way.
Run debug server explicitly on some port no and specify this port no in launch.json as value of "debugServer" attribute. In this case vscode connects on this port no. Debug server is spawned as a separate process and the code to spawn it is written typically in extension.
Debug adapter is started by vscode itself. Debug adapter's executable is mentioned in package.json as the value of "program" attribute under "debuggers" section.
Now my question is regarding second point. vscode is the client of Debug adapter (which is DAP server). vscode must know the port no of the server started within the debug adapter in order to connect to it and later send request.
Now suppose if my debug adapter is creating a server on port 9990, than how should I tell vscode to use 9990 as port no to connect to debug adapter which will be started by vscode itself.
The text was updated successfully, but these errors were encountered: