Repository navigation
Closed
Labels
apiapi-finalizationfeature-requestRequest for new features or functionalityon-testplanworkbench-viewsWorkbench view issues
Milestone
Description
Problem
The need to have meaningful and actionable content rendered on empty views has been arising across the workbench:
- SCM: SCM: Viewlet should improve "no repositories" messaging #61491
- Debug: Make run and debug welcome view extensible #85548
- Custom Views: Remote Containers: Guide users to create the first container when non exists vscode-remote-release#1349
Proposal
Let's enable the following in the core:
- Add an overridable
isEmpty(): booleanmethod toViewPanewhich would let view panes dictate when they are empty, as well asonDidChangeEmptyevent - Create a core contribution point for empty view content, supporting very simple Markdown (links only)
- Enhance the simple Markdown to be able to detect isolated command links and render them as buttons
- Render all empty view contributions in a
ViewPanewhenisEmpty() === true
We can then update our API by exposing an extension contribution point for the same core contribution point created above. Here's a couple of proposals:
contributes.documentation.VIEWID
"contributes": {
"documentation": {
"VIEWID": [{
"label": "MARKDOWN",
"when": "CONDITION"
}]
}
}Alternatives for documentation: viewhelp, emptyview.
Alternatives for label: text, markdown, description.
contributes.documentation.view
"contributes": {
"documentation": {
"view": [{
"label": "MARKDOWN",
"when": "VIEWID && CONDITION"
}]
}
}cc SteVen Batten (@sbatten) for views
cc Isidor Nikolic (@isidorn) for debug
cc Sandeep Somavarapu (@sandy081), Alex Ross (@alexr00) for custom views
cc Bowden Kelly (@bowdenk7) for scm
cc Johannes Rieken (@jrieken) for input on API conventions
Reacted by Alessandro Fragnani
Metadata
Metadata
Labels
apiapi-finalizationfeature-requestRequest for new features or functionalityon-testplanworkbench-viewsWorkbench view issues
Activity
isidorn commentedon Jan 22, 2020
Looks good to me.
I prefer the
contributes.documentation.VIEWID. That has the benefits of being more clear what it targets, looks more like the menu syntax and makes it easier for extensions to writewhenclauses.I am personally not a big fan of the
documentationname, however since we already use it in other places I think it makes sense to use it here also.labelis usually just a uxlabel, this feels to me as bit more. So I would prefercontentormarkdown.Also note that debug would render something before this contributed section and something after this contributed section if possible. So the view should have the start, middle and end. With the middle being contributable.
fyi Andre Weinand (@weinand)
jrieken commentedon Jan 22, 2020
I guess we also need an event for when that's changing...
jrieken commentedon Jan 22, 2020
Also adding Matt Bierner (@mjbvz) for the
doccontribution pointmjbvz commentedon Jan 22, 2020
Could we put this on
viewscontribution itself? Something like:{ "contributes": { "views": { "explorer": [ { "id": "nodeDependencies", "name": "Node Dependencies", "when": "workspaceHasPackageJSON", "emptyContent": [{ "markdown": "My empty message", "when": "CONDITION" }] } ] } } }If we prefer the
documentationcontribution point, I prefer thecontributes.documentation.viewapproach as it lets us control the top level of thedocumentationnamespace.jrieken commentedon Jan 23, 2020
One goal is that another extension can contribute getting-started text, e.g. a GH extension can contribute to the SCM view, etc. Not sure how that would look with this integrated approach
isidorn commentedon Jan 23, 2020
Also it does not make a lot of sense for debug. Since all our extensions are not contributing views, and all of them want to contribute to our start view.
joaomoreno commentedon Jan 24, 2020
It turns out using markdown for this isn't feasible, since the library we currently use doesn't allow to prevent certain features (headers, tables, etc), not even using the renderer API. Since all we want are actually links, another option is to extract the work Benjamin Pasero (@bpasero) did for notifications into something reusable.
mjbvz commentedon Jan 24, 2020
João Moreno (@joaomoreno) We use
insaneto sanitize rendered markdownvscode/src/vs/base/browser/markdownRenderer.ts
Line 189 in 82ed3d4
Could you configure it to only allow a very specific set of tags (try the
allowedTagsattribute)? Not sure if this would still be confusing for extension authorsjoaomoreno commentedon Jan 27, 2020
We would only want to support links in this feature. No headers, no images, no styling, no lists, no tables. So, we'd need a markdown feature set filter.
17 remaining items
isidorn commentedon Mar 6, 2020
Assigning to me, ropening and adding api-finalisation since we would like to finalise this API this milestone.
alexr00 commentedon Mar 6, 2020
Assigning to me too since this impacts custom views as well.
isidorn commentedon Mar 24, 2020
Feedback from Jonathan Carter
"Hey! Yep I tried it out, and it worked great. I'm looking forward to being able to use this for most of our team's extensions: Live Share, VS Online, etc."
Johannes Rieken (@jrieken) so we got some positive feedback on API from extensions. Let me know if there is something else we need to do before we finalise it.
jrieken commentedon Mar 24, 2020
go for it. add a test plan item and these things
isidorn commentedon Mar 24, 2020
I have removed the proposed API check. Since this was already tested last milestone via #91269 I will simply reopen that test plan move it to this milestone and only let 1 person be assigned to it.