-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(dap): send Disconnect if Terminated event received #5532
feat(dap): send Disconnect if Terminated event received #5532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just realised the restart implementation I made is not correct according to the spec. will redo it
I have re-read the spec and I believe this part of the restart sequence to be correct. What needs to be done in addition is to expose a restart request, if supported, to the user, same as with launch, terminate etc. Cc: @pascalkuthe could we move it to waiting on review? Many thanks! |
cce45ed
to
d8180a5
Compare
d8180a5
to
90e1df2
Compare
Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon helix-editor#5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: helix-editor#5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
90e1df2
to
bde318b
Compare
bde318b
to
30462ff
Compare
Send a `Disconnect` DAP request if the `Terminated` event is received. According to the specification, if the debugging session was started by as `launch`, the debuggee should be terminated alongside the session. If instead the session was started as `attach`, it should not be disposed of. This default behaviour can be overriden if the `supportTerminateDebuggee` capability is supported by the adapter, through the `Disconnect` request `terminateDebuggee` argument, as described in [the specification][discon-spec]. This also implies saving the starting command for a debug sessions, in order to decide which behaviour should be used, as well as validating the capabilities of the adapter, in order to decide what the disconnect should do. An additional change made is handling of the `Exited` event, showing a message if the exit code is different than `0`, for the user to be aware off the termination failure. [discon-spec]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect Closes: helix-editor#4674 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
@archseer implemented your comments, thanks very much for the patience and advice, I have learnt a lot and hopefully improved the way I write Rust. I also rebased the PR and squashed the commits, to make it a bit cleaner, since there are not that many modifications (hopefully) as to make it a chore to revisit the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took me a while to get back to this! LGTM!
No worries, thanks for reviewing and merging it! |
Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon helix-editor#5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: helix-editor#5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon #5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: #5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon helix-editor#5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: helix-editor#5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
…#5532) Send a `Disconnect` DAP request if the `Terminated` event is received. According to the specification, if the debugging session was started by as `launch`, the debuggee should be terminated alongside the session. If instead the session was started as `attach`, it should not be disposed of. This default behaviour can be overriden if the `supportTerminateDebuggee` capability is supported by the adapter, through the `Disconnect` request `terminateDebuggee` argument, as described in [the specification][discon-spec]. This also implies saving the starting command for a debug sessions, in order to decide which behaviour should be used, as well as validating the capabilities of the adapter, in order to decide what the disconnect should do. An additional change made is handling of the `Exited` event, showing a message if the exit code is different than `0`, for the user to be aware off the termination failure. [discon-spec]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect Closes: helix-editor#4674 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
Add a restart debug session command, which would issue a [Restart Request][1], if the debugger supports it and a session is running. It uses the same arguments and requests used to start the initial session, when recreating it. It builds upon helix-editor#5532, making use of the changes to the termination workflow of a session. [1]: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart Closes: helix-editor#5594 Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
Send a
Disconnect
DAP request if theTerminated
event is received. According to the specification, if the debugging session was started by aslaunch
, the debuggee should be terminated alongside the session. If instead the session was started asattach
, it should not be disposed of.This default behaviour can be overriden if the
supportTerminateDebuggee
capability is supported by the adapter, through theDisconnect
requestterminateDebuggee
argument, as described inthe specification.
This also implies saving the starting command for a debug sessions, in order to decide which behaviour should be used, as well as validating the capabilities of the adapter, in order to decide what the disconnect should do.
An additional change made is handling of the
Exited
event, showing a message if the exit code is different than0
, for the user to be aware off the termination failure.Closes: #4674
Signed-off-by: Filip Dutescu filip.dutescu@gmail.com