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

SCMResourceDecorations ambiguity #23600

Closed
chrmarti opened this issue Mar 29, 2017 · 6 comments
Closed

SCMResourceDecorations ambiguity #23600

chrmarti opened this issue Mar 29, 2017 · 6 comments
Assignees
Labels
api scm General SCM compound issues
Milestone

Comments

@chrmarti
Copy link
Collaborator

  • VSCode Version: Code - Insiders 1.11.0-insider (6ae8c15, 2017-03-29T08:21:59.122Z)
  • OS Version: Linux x64 3.13.0-108-generic
  • Extensions: none

Testing #23311

SCMResourceDecorations has an iconPath and at the same time dark and light, all can be specified in the same decoration, but only dark/light will be used. An alternative that only allows one of the two options at once would be:

type SCMThemableDecoration<T> = T | { dark?: T; light?: T; };

interface SCMResourceDecorations {
    strikeThrough?: boolean;
    iconPath?: SCMThemableDecoration<string | Uri>;
}

let a: SCMResourceDecorations = {
    iconPath: 'foo'
}

let b: SCMResourceDecorations = {
    iconPath: {
        dark: 'bar',
        light: 'baz'
    }
}
@joaomoreno
Copy link
Member

Interesting. I went with the same approach as for the editor decoration api.

Thoughts @jrieken ?

@joaomoreno joaomoreno added this to the March 2017 milestone Mar 30, 2017
@joaomoreno joaomoreno added api scm General SCM compound issues labels Mar 30, 2017
@jrieken
Copy link
Member

jrieken commented Mar 30, 2017

@alexandrudima and @aeschli know the reasoning behind the editor decoration API. As usual I am in for consistence. Also the editor inherit and overwrite approach has the benefit of not needing to repeat equal values. That will come into play once there are more values, but then it allows you define the defaults in the literal and then you only have specialisations/overrides in the light/dark part

@jrieken
Copy link
Member

jrieken commented Mar 30, 2017

Tho what we could consider is to always use the Uri for the path. I know it's sort of legacy that the editor decoration api supports both and there was ambiguity if strings mean url or file path (see #12111 (comment))

@joaomoreno
Copy link
Member

As per last comment: #23648

@alexdima
Copy link
Member

The editor decorations allow to specify different values for dark/light at decoration creation time because we want to be able to switch themes without deleting all decorations or needing to go back to extensions and ask them to update the decorations to match the new theme. i.e. decorations are set with both light/dark options and we can easily flip between the light/dark options when the theme changes on the UI thread, without pinging extensions and without loosing decorations.

@joaomoreno
Copy link
Member

I would go for consistency here and keep the same API.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api scm General SCM compound issues
Projects
None yet
Development

No branches or pull requests

4 participants