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

Support proposed DecorationProvider api on custom views #47502

Closed
eamodio opened this issue Apr 9, 2018 · 7 comments
Closed

Support proposed DecorationProvider api on custom views #47502

eamodio opened this issue Apr 9, 2018 · 7 comments
Assignees
Labels
api feature-request Request for new features or functionality file-decorations on-testplan tree-views Extension tree view issues
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Apr 9, 2018

Currently it looks like the DecorationProvider api, only applies to the explorer file tree. Can this be expanded to apply to custom view trees as well?

Maybe expand to include an optional viewId

registerDecorationProvider(provider: DecorationProvider, viewId?: string): Disposable

The DecorationProvider.provideDecoration will also need to be updated to support TreeItem (or the item element itself?)

provideDecoration(uriOrTreeItem: Uri | TreeItem, token: CancellationToken): ProviderResult<DecorationData>;

Also while its probably not ideal, I did wonder if setting a resourceUri on a TreeItem would trigger the decoration, but it doesn't either.

/cc @sandy081

@jrieken jrieken added api file-decorations feature-request Request for new features or functionality labels Apr 10, 2018
@jrieken
Copy link
Member

jrieken commented Apr 10, 2018

Yes, plan is to make the DecorationProvider api public. However, but its nature it decorates URIs wherever they show. Things we should do IMO

  • allow tree view item to be decorated
  • make the decoration provider api general available

@eamodio
Copy link
Contributor Author

eamodio commented Apr 10, 2018

Hrm, showing decorations where ever a URI is seems like it could be very undesirable in many cases. If I have a custom view that I want to decorate items with (that represent files) and my decorations would now show everywhere they would now conflict with the scm/git decorations and vice versa. If that was still the desired behavior, it would be nice if the custom view (or custom view item) could opt-in (or out) of global decorations.

Will there be a way to decorate custom tree items then (that would not affect anything outside a specific tree)? Maybe those decorations could be applied directly on the custom tree item itself (i.e. props or something provided to the TreeItem)?

For example, I am definitely looking for ways of bolding, italicising, coloring, badging tree items for the CodeStream extension I am currently working on.

@sandy081 sandy081 added the tree-views Extension tree view issues label Apr 16, 2018
@sandy081 sandy081 self-assigned this Apr 16, 2018
@sandy081
Copy link
Member

I see there are two kinds of requests here from a custom view perspective.

  1. Apply the file decorations also to custom view if it is based on URIs. This can be opted out by user using settings just like how it is now.
  2. Allow extensions to decorate custom view items.

First one looks sensible but there are no plans yet to support second one.

@eamodio
Copy link
Contributor Author

eamodio commented Apr 16, 2018

I think so, but #1 is more nuanced imo.

I honestly was more thinking about #1 as a way to get #2 -- use "custom" uris (foo://whatever) to attach to the resourceUri and then use the DecorationProvider to only respond to those custom uris. Which would in theory provide decorations for the custom view. But the flip side to this, is that would make all of the explorer decorations automatically apply to all custom views (if they were using real file uris) and that may or may not be desirable.

Maybe an alternative would be to add a way (property or something) on the custom view to opt-out of decorations if they wanted.

@d-akara
Copy link

d-akara commented May 29, 2018

  1. Allow extension to decorate custom view items

This is a very needed feature for tree views that I'm creating. It places significant impediments on the readability of the data presented when there are lots of attributes.

@sandy081 sandy081 added this to the July 2018 milestone Jul 9, 2018
@sandy081
Copy link
Member

sandy081 commented Jul 9, 2018

Adding to July as stretch item.

@sandy081
Copy link
Member

sandy081 commented Jul 24, 2018

Added support for resource based decorations in custom views. Decorations are shown automatically when a resource uri is provided and there are decorations for that resource. These can be controlled by user using the existing following settings

explorer.decorations.colors
explorer.decorations.badges

If the extension providing custom view does not want the decorations to be shown, then it should not provide resource uri. This is much analogous to theme icons derived from resources.

Created a separate feature request #54938 to make decoration provider api public.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 7, 2018
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 file-decorations on-testplan tree-views Extension tree view issues
Projects
None yet
Development

No branches or pull requests

4 participants