Skip to content

Allow tree views to use icons for symbol kinds on their nodes #45057

Closed

Description

@DanTup

To display icons in explorer trees we can either pass a path or use resourceUri, there's no way to re-use icons used elsewhere in code for symbol types (for example in the workspace symbol searches).

This means that extensions with trees representing code have to ship their own icons (for ex. the "Code Outline" extension has its own: https://github.com/patrys/vscode-code-outline/tree/58008bfa3cc36ad2c18df53b2b4e53dc10a75d55/resources/light) which means they may not be consistent with the icons rendered elsewhere in code.

Is it possible to add something like a symbolKind: SymbolKind?

Activity

  1. jrieken commented on Mar 5, 2018

    @jrieken
    Contributor

    Closing this in favour of #5605 which is something we will do within the next 2 or 3 milestones

  2. DanTup commented on Mar 5, 2018

    @DanTup
    ContributorAuthor

    Johannes Rieken (@jrieken) That sounds good - though in this case this is a specialised tree and not the normal symbol view of my document (it's a sort of render tree we build from static analysis to help the user visualise their UI). With #5606 will it be possible to have a custom tree that can render in a similar way (eg. both a stanadard symbol tree and this custom tree)?

  3. DanTup commented on Mar 5, 2018

    @DanTup
    ContributorAuthor

    Here's an example of the tree in IntelliJ. The items are not all symbols defined in the document, but in many cases constructor invocations that would create a widget (for ex. MaterialApp inside build is a new MaterialApp(...) call).

  4. jrieken commented on Mar 5, 2018

    @jrieken
    Contributor

    With #5606 will it be possible to have a custom tree that can render in a similar way (eg. both a stanadard symbol tree and this custom tree)?

    Yeah, should be possible... The idea is to extend the DocumentSymbelProvider so that it can return hierarchical data. However, the idea is also to allow for different representations of that data, e.g. a break-crumb and/or a tree. Also likely that the tree will sit where the minimap sits.

    What you are trying to achieve seems a little further away from "normal" outline, tho there is no normal outline...

  5. DanTup commented on Mar 5, 2018

    @DanTup
    ContributorAuthor

    Johannes Rieken (@jrieken) Yeah, I understand our need is somewhat unusual. Using the DocumentSymbolProvider for this would feel a bit weird since it's not semantically the same.

    Another possible option might be to provide us with a way to get the Uri for a Uri fo built-in icons that we could provide to the existing explorer tree? That would be fairly generic/reusable and probably relatively simple to implement?

  6. jrieken commented on Mar 6, 2018

    @jrieken
    Contributor

    cc Sandeep Somavarapu (@sandy081) who is doing some work on icons

  7. sandy081 commented on Mar 6, 2018

    @sandy081
    Member

    Last milestone we introduced constants to represent themed folder or file icons. May be this can be done using similar approach?

    Johannes Rieken (@jrieken) Are there constants in the API representing document symbol icons?

  8. DanTup commented on Mar 8, 2018

    @DanTup
    ContributorAuthor

    I don't know if this answers the question but there's an enum named SymbolKind which is used in the SymbolInformation types returned by the symbol providers. My need is to be able to display an icon for one of them in the contributed tree.

  9. sandy081 commented on Mar 12, 2018

    @sandy081
    Member

    Danny Tuppeny (@DanTup) Thanks.

    Johannes Rieken (@jrieken) How about extending iconPath to take SymbolKind constant in addition ?

  10. 4 remaining items

  11. sandy081 commented on Mar 12, 2018

    @sandy081
    Member

    Ok, Makes sense.

  12. axetroy commented on Mar 18, 2018

    @axetroy
    Contributor

    agree.

  13. DanTup commented on Jul 11, 2019

    @DanTup
    ContributorAuthor

    Is it likely there may be any progress on this in the near future? I'm currently thinking about just taking a copy of the icons from here and periodically updating them. It doesn't feel like an ideal solution, but users have been asking for a Flutter Outline for well over a year and I'd really like to deliver something.

  14. sandy081 commented on Jul 12, 2019

    @sandy081
    Member

    No progress.. also given that outline view is provided out of the box, not sure if it is needed for other extensions.

  15. DanTup commented on Jul 12, 2019

    @DanTup
    ContributorAuthor

    I tried many times to use the built-in outline, but it does not support being extended as required here and I was guided towards a custom tree. Specifically, it does not have:

    I'm also not sure it has selected events, which I'd also need to set contexts correctly so my context menus can work.

    I've got prototypes going both ways, but neither are great. I would prefer to extend the built-in outline, but more requests have been rejected for supporting that than the custom tree, so I figure it has to be this way.

  16. aeschli commented on Oct 9, 2019

    @aeschli
    Contributor

    The request to use the VSCode icons in extensions is #31466

  17. DanTup commented on Oct 9, 2019

    @DanTup
    ContributorAuthor

    Yeah, this is a dupe of that. Like everyone else, I've just copied all the icons from VS Code into my project 😞

  18. locked and limited conversation to collaborators on Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-requestRequest for new features or functionalitythemesColor theme issuestree-viewsExtension tree view issues

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions