Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DanTup opened this issue Mar 5, 2018 · 17 comments
Closed

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

DanTup opened this issue Mar 5, 2018 · 17 comments
Assignees
Labels
api feature-request Request for new features or functionality themes Color theme issues tree-views Extension tree view issues
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Mar 5, 2018

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?

@jrieken
Copy link
Member

jrieken commented Mar 5, 2018

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

@jrieken jrieken closed this as completed Mar 5, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Mar 5, 2018

@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)?

@DanTup
Copy link
Contributor Author

DanTup commented Mar 5, 2018

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).

@jrieken jrieken reopened this Mar 5, 2018
@jrieken
Copy link
Member

jrieken commented Mar 5, 2018

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...

@jrieken jrieken added api under-discussion Issue is under discussion for relevance, priority, approach tree-widget Tree widget issues labels Mar 5, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Mar 5, 2018

@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?

@jrieken
Copy link
Member

jrieken commented Mar 6, 2018

cc @sandy081 who is doing some work on icons

@sandy081
Copy link
Member

sandy081 commented Mar 6, 2018

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

@jrieken Are there constants in the API representing document symbol icons?

@DanTup
Copy link
Contributor Author

DanTup commented Mar 8, 2018

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.

@sandy081
Copy link
Member

@DanTup Thanks.

@jrieken How about extending iconPath to take SymbolKind constant in addition ?

@jrieken
Copy link
Member

jrieken commented Mar 12, 2018

How about extending iconPath to take SymbolKind constant in addition

That doesn't sound right to me... I think we should make them part of the themes and, assuming my understanding of themes is correct, make them reusablable by that

@sandy081 sandy081 added themes Color theme issues tree-views Extension tree view issues and removed tree-widget Tree widget issues under-discussion Issue is under discussion for relevance, priority, approach labels Mar 12, 2018
@sandy081 sandy081 added this to the Backlog milestone Mar 12, 2018
@sandy081 sandy081 added the feature-request Request for new features or functionality label Mar 12, 2018
@sandy081
Copy link
Member

Ok, Makes sense.

@axetroy
Copy link
Contributor

axetroy commented Mar 18, 2018

agree.

@DanTup
Copy link
Contributor Author

DanTup commented Jul 11, 2019

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.

@sandy081
Copy link
Member

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

@DanTup
Copy link
Contributor Author

DanTup commented Jul 12, 2019

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.

@alexr00 alexr00 self-assigned this Oct 7, 2019
@aeschli
Copy link
Contributor

aeschli commented Oct 9, 2019

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

@DanTup
Copy link
Contributor Author

DanTup commented Oct 9, 2019

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

@DanTup DanTup closed this as completed Oct 9, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality themes Color theme issues tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests

6 participants