microsoft / vscode-mock-debug

Starter sample for developing debug adapters for VSCode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to display error info to the user on failed launchRequest?

paulo-fernando-silva opened this issue · comments

commented

I'm trying to warn the user that the debugger failed to start, but I'm not seeing how to do that from the debugger extension.

We don't seem to be able to display dialogs to the user (different process).

Throwing an exception only displays the word '{stack}', which I don't understand the point. Might just be a bug on the exception handling. Missing a $ in '${stack}'?

If the error is on launchRequest, e.g. the extension failed to find the executable it needs to connect to, and therefore can't continue, using logger.error('foo') never gets the opportunity to be displayed on the client console as the extension exits before that. Maybe I could delay the exit and pretend for a while that everything went well. but that seems like a contrived way to achieve the simple objective of displaying a message to the user.

This being a didactic sample, it think it would be good if it also covered this kind of error feedback as it doesn't seem to obvious.

Sorry to post a question as an issue. I've posted it on stackoverflow, but it's not getting much traction.

commented

Well, I've found the solution just now by coincidence while trying private _configurationDone = new Subject(); instead of my solution posted in a different issue on this repo.
It turns out that one needs to wait for the configurationDoneRequest before messages are sent back to the user console. Any messages sent before that are not shown.