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_RestartCloses: #5594
Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
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_DisconnectCloses: #4674
Signed-off-by: Filip Dutescu <filip.dutescu@gmail.com>
DAP follows the same strict TypeScript interface syntax as LSP
which states:
> The document uses TypeScript interfaces in strict mode to describe
> these. This means for example that a `null` value has to be explicitly
> listed and that a mandatory property must be listed even if a falsify
> value might exist.
So we have to skip serializing any fields that end in `?` instead
of passing `null`.
* Refactor menu::Item to accomodate external state
Will be useful for storing editor state when reused by pickers.
* Add some type aliases for readability
* Reuse menu::Item trait in picker
This opens the way for merging the menu and picker code in the
future, since a picker is essentially a menu + prompt. More
excitingly, this change will also allow aligning items in the
picker, which would be useful (for example) in the command palette
for aligning the descriptions to the left and the keybinds to
the right in two separate columns.
The item formatting of each picker has been kept as is, even though
there is room for improvement now that we can format the data into
columns, since that is better tackled in a separate PR.
* Rename menu::Item::EditorData to Data
* Call and inline filter_text() in sort_text() completion
* Rename diagnostic picker's Item::Data