Open rehmsen opened 1 year ago
This is even more complex than you describe, because there is one more dimension- how the debug request was triggered. I tested this by failing setBreakpoints
, and when it is triggered by a keypress, the error bubbles up to the keybindings service and is shown there
So what I see is
And as you point out, showUser is ignored when a url is set, but that means that it still never shows an error if you clicked and it always shows one if you used a keybinding. There might be even more to that, depending on what command you were testing with and how you triggered it.
I dug into the history of the code, and I think it's clear that the intent is that showUser
should be interpreted in the way you expect and be independent of the url
property. I would call that aspect a bug. Really just a reference for myself later:
Then for the next part of the issue, what showErrors
does, that was added for this issue https://github.com/microsoft/vscode/issues/128484 basically we are showing the error dialog somewhere else upstream for some requests, and that upstream code was changed to support showUser
but we need to set that property on the error for errors with url
too.
Thanks for looking into this, and great that we are aligned that this should be improved. Let me know if I can do anything to help.
Seems like showUser is treated differently if not defined in different places too:
It would be good to expand the documentation here. The DAP spec only says "If true show user", but it's not clear what that means... does it mean show an extra error notification in addition to in the context of where this failed, or does it mean show an error at all?
Setting true
causes this toast notification here that is unhelpful:
So it seems like false
might be better (the error will still appear in the debug console, watch window, etc.). However it's not clear from the spec that that's the meaning - it could be interpreted to mean that showError: false
means not to show the error anywhere.
It's important that DAP clients have similar behaviour because otherwise it's impossible for a debug adapter to know what to use (or, it'll start sniffing clients, and that would be bad for everyone :-) )
Does this issue occur when all extensions are disabled?: Yes/No
Steps to reproduce
Various combinations in the error response
Handling of debug adapter protocol error responses is confusing:
showUser
(from DAP) andshowErrors
(passed tosend
) are ignored when aurl
is provided - it will always show a dialog:showUsers
isfalse
,showErrors
is ignored - it will never show a message (this may be fine, but thenshowErrors
could probably be named better)showUser
istrue
showErrors
confusingly controls whether to show them in a dialog (showErrors= false
) or in a notification (showErrors=true
)showErrors
isfalse
, and noerror.format
is send from DAP, it will still show a dialog, but the dialog will be empty, looking broken.This is the logic I am referring to: https://github.com/microsoft/vscode/blob/c29e4b0fdb6b63c23be7055feb5a188784a86691/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts#L760-L785
DAP unfortunately does not specify exactly what should happen if showUser is false but a URL is provided: https://github.com/microsoft/debug-adapter-protocol/issues/387
It also does not seem to have a way to express severity so that one could decide whether a dialog or a notification is more appropriate. In the absence of that, maybe this should be decided based on criticality of the request?
I think it would make sense that:
showUser=true
, it should have the text from the DAP responseshowUser=false
, it should be a generic failure message generated on the clientshowUser=true
should show a notification - if aurl
is provided, it could be a prompt notification with actionsshowUser=false
should not show anything to the userIn my mind,
"initialize"
is a critical requests. I wonder why VSCode chose to setshowErrors=false
for"initialize"
requests (andtrue
for almost everything else) - maybe it is because a failure to initialize then causes a "disconnect" request, which already shows an error?@weinand @roblourens and @isidorn Seems to have worked on this function and may have additional background as to the intentions here?
I would be happy to contribute here, but we probably need to get on the same page regarding the desired behavior first.