Repository: vscode
Issue: Extension API to Access ExceptionWidget (or ZoneWidget)
Labels: feature-request,debug

As an extension developer, I need a way to report exceptions **outside** of a Debug Session context. This occurs because [the extension I'm working on](https://marketplace.visualstudio.com/items?itemName=Adobe.extendscript-debug) offers a command to evaluate a script in a host engine directly (no Debug Session necessary). When an error occurs during evaluation, I would like to present the error to the user in a native manner that uses the same design language that VSCode users are accustomed to. Currently, this means using the [debug `ExceptionWidget`](https://github.com/microsoft/vscode/blob/1.63.2/src/vs/workbench/contrib/debug/browser/exceptionWidget.ts).

I have evaluated the following options:

- [`Diagnostics`](https://code.visualstudio.com/api/language-extensions/programmatic-language-features#provide-diagnostics) - While this is visually close to the desired effect, the UX is fundamentally different. As an LSP feature, it expects the server to constantly keep the system updated based on status. The UX I'm looking for here would involve someting temporary that the user could manually close with a button in, say, the top right of the message portion.
- [`Comment`](https://code.visualstudio.com/api/references/vscode-api#CommentController) - Presumably this API is used by extensions like [CodeTour](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour) and enables in-line comment threading. (It is difficult to say, really, because I can't find an official example in VSCode's documentation.) The UX for this (as I understand it) is also not a good fit as there isn't a way to format this comment to appear as an error.
- [`TextEditorDecorationType`](https://code.visualstudio.com/api/references/vscode-api#TextEditorDecorationType) - This actually gets us closest to what we want to provide as an experience to our users. We can use this feature to adjust the color of the background to the [`debugExceptionWidget.background` theme color](https://code.visualstudio.com/api/references/theme-color#editor-widget-colors) and provide a "hover message". While there's no "close" button, the decoration does automatically clear when the TextEditor to which it is applied becomes a background tab. That said, this is _still_ a poor-person's approximation of the excellent Debug Exception Widget UI/UX and I would very much prefer using it instead of managing this kludge myself.

As mentioned above, the _closest_ we're currently able to get is by using the `TextEditorDecorationType` which gets us something that looks like this:

![image](https://user-images.githubusercontent.com/9142587/149601011-992475c9-bbc6-49f0-894a-871170b94fe4.png)

However, I think we can all agree that this is a far cry from the target of:

![image](https://user-images.githubusercontent.com/9142587/149601179-256f63f5-aa55-4db4-bb40-a29143ac732e.png)

To that end, it would be very helpful to extension developers to add APIs to either control [the `ExceptionWidget` directly](https://github.com/microsoft/vscode/blob/899d46d82c4c95423fb7e10e68eba52050e30ba3/src/vs/workbench/contrib/debug/browser/exceptionWidget.ts#L29) or to create our own [custom `ZoneWidget` instances](https://github.com/microsoft/vscode/blob/899d46d82c4c95423fb7e10e68eba52050e30ba3/src/vs/editor/contrib/zoneWidget/zoneWidget.ts#L166).