Skip to content

Views: Support contributable welcome view content #89080

Closed

Description

Problem

The need to have meaningful and actionable content rendered on empty views has been arising across the workbench:

Proposal

Let's enable the following in the core:

  1. Add an overridable isEmpty(): boolean method to ViewPane which would let view panes dictate when they are empty, as well as onDidChangeEmpty event
  2. Create a core contribution point for empty view content, supporting very simple Markdown (links only)
  3. Enhance the simple Markdown to be able to detect isolated command links and render them as buttons
  4. Render all empty view contributions in a ViewPane when isEmpty() === 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

Activity

  1. isidorn commented on Jan 22, 2020

    @isidorn

    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 write when clauses.

    I am personally not a big fan of the documentation name, however since we already use it in other places I think it makes sense to use it here also.

    label is usually just a ux label, this feels to me as bit more. So I would prefer content or markdown.

    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)

  2. jrieken commented on Jan 22, 2020

    @jrieken
    Contributor

    Add an overridable isEmpty(): boolean method to ViewPane which would let view panes dictate when they are empty

    I guess we also need an event for when that's changing...

  3. jrieken commented on Jan 22, 2020

    @jrieken
    Contributor

    Also adding Matt Bierner (@mjbvz) for the doc contribution point

  4. mjbvz commented on Jan 22, 2020

    @mjbvz
    Contributor

    Could we put this on views contribution itself? Something like:

    {
      "contributes": {
        "views": {
          "explorer": [
            {
              "id": "nodeDependencies",
              "name": "Node Dependencies",
              "when": "workspaceHasPackageJSON",
              "emptyContent": [{
                "markdown": "My empty message",
                "when": "CONDITION"
              }]
            }
          ]
        }
      }
    }

    If we prefer the documentation contribution point, I prefer the contributes.documentation.view approach as it lets us control the top level of the documentation namespace.

  5. jrieken commented on Jan 23, 2020

    @jrieken
    Contributor

    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

  6. isidorn commented on Jan 23, 2020

    @isidorn

    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.

  7. joaomoreno commented on Jan 24, 2020

    @joaomoreno
    ContributorAuthor

    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.

  8. mjbvz commented on Jan 24, 2020

    @mjbvz
    Contributor

    João Moreno (@joaomoreno) We use insane to sanitize rendered markdown

    element.innerHTML = insane(renderedMarkdown, {

    Could you configure it to only allow a very specific set of tags (try the allowedTags attribute)? Not sure if this would still be confusing for extension authors

  9. joaomoreno commented on Jan 27, 2020

    @joaomoreno
    ContributorAuthor

    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.

  10. 17 remaining items

  11. isidorn commented on Mar 6, 2020

    @isidorn

    Assigning to me, ropening and adding api-finalisation since we would like to finalise this API this milestone.

  12. alexr00 commented on Mar 6, 2020

    @alexr00
    Member

    Assigning to me too since this impacts custom views as well.

  13. isidorn commented on Mar 24, 2020

    @isidorn

    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.

  14. jrieken commented on Mar 24, 2020

    @jrieken
    Contributor

    go for it. add a test plan item and these things

  15. isidorn commented on Mar 24, 2020

    @isidorn

    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.

  16. locked and limited conversation to collaborators on May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址