-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Prepare for node -> node2 transition #19650
Comments
Wrapping both adapters into one "smart adapter" has the problem that all feature negotiation between the frontend and the debug adapter (DA) happens before the adapter knows what Node.js version is being used. It's difficult for the combined DA to return the correct capabilities if it doesn't know whether it will turn into 'node' or 'node2' when it eventually attaches to Node.js. For this reason I propose that we fold both adapters into a single extension in a "semi-smart way":
Since this transitions is non-trivial and involves many details, I suggest that we do not rush this through in a single milestone but plan for a staged, two milestone approach. I propose the following steps:
|
It just occurred to me, that we could use the approach from above even if we keep both debug extensions, but just remove (comment out) the "debuggers" contribution from 'node-debug2'. |
That's a good idea. I don't think there will be a problem with the launch configs being compatible. You made me think of another problem with having one debugger type for the two adapters, which is that static differences like the callstack context menu contribution will appear for both, but do nothing for 'node', unless we add a way to hide it. I think Maybe an intermediate step for February could be to deprecate |
Or we could do the autodetect logic in |
You might also query Output on my system:
|
@roblourens I've added support for a 'protocol' attribute. If 'protocol == auto' I'm probing for the node version by running To simplify alignment of required attributes between the two adapters, I've made the Since the 'node2' extension contributes snippets and initial configurations there is a chance that node2 appears in the UI. I suggest that we remove these contributions as soon as we have verified that we are not loosing functionality (because we are covered by the contributions in node-debug). For the callstack context menu contributions I'll add a corresponding implementation for node-debug. |
@roblourens probably the most valuable addition to the version probing would be for the case This would have solved the problem I was running into when using the "Attach to Extension Host" launch config of VS Code. It was using 'node2' which didn't worked because the EH uses the Electron node which does not support the '--inspect' option. |
Agree, I'll work on that |
Done. I changed the minimum version for node2 to 6.9 because it crashed a lot on windows before that, and there was some flakiness on other platforms too. I didn't do anything different with the 'runtimeExecutable' case because checking the version of node on the path is probably the best thing to do most of the time. Maybe we should log a message when the node version is inferred though. I'll open an issue for it. |
@roblourens great, thanks! I noticed that you do the |
I actually only do it if |
Indeed, so your |
The attach probing is tricky... If I start node v6.5 with this:
attach will not work because the probing code sees a version < 6.9 and decides that 'v8-inspector' is not supported. But the 'legacy' DA doesn't work either, because debugging was not enabled for the legacy protocol (due to the '--inspect' flag). So there is no fallback at all. I think we'll have to use the 'v8-inspector' whenever the 9229 port returns a valid json (independent from the version). Maybe we should use a port '5858' as an indication for 'legacy' and '9229' for 'v8-inspector'. And only for all other values we would do the probing. |
Oh yeah, that's a good point - for attach we need to support any node version with the v8-inspector protocol. That's not a problem. I've seen people use 5858 for debugging with node2, so I don't want to make any assumptions based on the port number. It seems seems fine as-is to check whatever port they specify for a v8-inspector server. |
I just pushed a change to rename "v8-inspector" to "inspector", to ensure it's a runtime-independent name. |
I've created these two items: microsoft/vscode-node-debug2#87 and microsoft/vscode-node-debug2#88 |
Also filed microsoft/vscode-node-debug#130 on myself to continue investigating. |
Everything planned for this milestone has been done. |
Since the legacy node debug protocol is on its way out, we need to continue preparing a seamless transition to the inspector debug protocol.
Status:
node --debug
will print a deprecation message, probably in some 7.x release - lib: deprecate node --debug at runtime nodejs/node#10970Possible February plan:
It would be good to have a seamless experience like in option 1 - a user doesn't care which debug protocol they use. That should be our job, if possible. There are some issues to deal with though.
runtimeExecutable
is specified, we will have to leave it up to the user. We can't always figure out its node version. It might be a script or something that isn't node. It might be electron, which ships a version of node 6.5 that doesn't include --inspect. We can probably figure out what this failure looks like, and give a helpful warning.http://localhost:port
.Other things to do:
FYI @weinand @joshgav
The text was updated successfully, but these errors were encountered: