Implement badge API for webviews and treeviews#144775
Implement badge API for webviews and treeviews#144775alexr00 merged 4 commits intomicrosoft:mainfrom
Conversation
mjbvz
left a comment
There was a problem hiding this comment.
Webview parts of the change look good to me!
alexr00
left a comment
There was a problem hiding this comment.
Looks good, just a few minor changes!
|
Thanks for the review @alexr00 and @mjbvz , I believe I've addressed all of the comments. I am still wondering about the question I added in the PR description, about how badges can be provided before the webview view is created -- I believe this is a fairly important use case. Do either of you have any thoughts on this? |
# Conflicts: # src/vs/workbench/api/browser/mainThreadTreeViews.ts # src/vs/workbench/api/common/extHostTreeViews.ts # src/vs/workbench/browser/parts/views/treeView.ts
|
I've cleaned up the conflicts this PR had with @mjbvz I'd appreciate any thoughts you have about the webview view initialization issue I outlined in the PR description, as I believe it might make the badge feature less useful for webview views. |
|
Merged, thank you for the PR! @mjbvz we can continue to address the webview view questions during API review. |
This PR fixes #62783
This PR implements the API proposal here: #139225
I largely followed the existing patterns for how the TreeView and WebView processes state changes through the extension host into the main application. I do have a few questions of the details of what I did, which I've added as PR comments.
I have only tested this manually, by modifying the TreeView and WebviewView sample extensions to provide badges, and running them in my own local build. It works as expected. I am not sure what the expectations are for writing automated tests for something like this, please let me know where I should add tests to a particular test suite.
I did notice one thing while working on this, which I think is worth discussing: in the WebView View badge case, I am not sure how badges can be provided after extension activation. Webview Views specify a badge through
WebviewView.badge, but you can only reference aWebViewViewonce it has been created (ie, once the user has opened up the Webview View, andWebviewViewProvider.resolveWebviewViewhas been called). I'm wondering if this is insufficient though: imagine a TODO extension, like https://github.com/Gruntfuggly/todo-tree (they are one extension that wants to use this API). If I used such an extension, I would expect that the badge would show up on the activation bar showing that I have TODOs as soon as I open up the workspace, even if I haven't yet opened up that extension's Webview View.This is not a problem for TreeView badges, because an extension can call
createTreeViewto force the TreeView to be created when the extension is activated, and can provide badges at that point.