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

Terminal decoration icon configuration doesn't go well with icon theming #156503

Closed
aeschli opened this issue Jul 27, 2022 · 5 comments · Fixed by #157094
Closed

Terminal decoration icon configuration doesn't go well with icon theming #156503

aeschli opened this issue Jul 27, 2022 · 5 comments · Fixed by #157094
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Jul 27, 2022

image

The settings to select an codicon for a decoration are not playing well with our product icon theming approach.

We want that a product icon theme can style all icons of our UI with a new icons. Each icon that we show should be defined with a component specific name
E.g. terminal-decoration-icon, terminal-decoration-error-icon, ...
That way the theme can come up with a custom icon for each icon location

The base icon names (circle-outline, primitive-dot, ...) should not be used directly, only as defaults, otherwise it gets complicated for a theme to change an icon as it affects many places, unknown to the theme. What might look good with our codicon based product icon theme, might look wrong with a theme that uses a different visual for primitive-dot

I suggest to remove the settings as we don't do that at other places. Instead we should refer to product icon themes as the way to change icons.

@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2022

Requested the aliases in microsoft/vscode-codicons#126

@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug terminal-shell-integration Shell integration, command decorations, etc. and removed debt Code quality issues terminal Integrated terminal issues labels Aug 3, 2022
@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2022

We do allow switching icons for terminals in this way which I think is fine as they're very temporal:

image

I see what you're saying here though, let's remove the setting and leave it up to the icon theme 👍. We have this setting now so it solves that part of what these icon settings allowed:

"terminal.integrated.shellIntegration.decorationsEnabled": "never" | "gutter" | "overviewRuler" | "both"

Tyriar added a commit that referenced this issue Aug 4, 2022
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Aug 4, 2022
joyceerhl pushed a commit that referenced this issue Aug 10, 2022
@aeschli
Copy link
Contributor Author

aeschli commented Aug 24, 2022

I was on vacation so I couldn't jump in here. It was not necessary to request new codicons or codicon aliases unless a new icon shape was needed, e.g. for a concept we didn't have yet.

There still seems to be a confusion of Codicons vs product icon icons.

The Codicon library is a set of default icons that are part of the Codicon font. We use these as default icons in VS Code.

See the spec of Codicon:

/**
 * The Codicon library is a set of default icons that are built-in in VS Code.
 *
 * In the product (outside of base) Codicons should only be used as defaults. In order to have all icons in VS Code
 * themeable, component should define new, UI component specific icons using `iconRegistry.registerIcon`.
 * In that call a Codicon can be named as default.
 */

codicon aliases should be component agnostic (no 'terminal', 'debug').

The componnet specific ids go in the product icon registry. These are the ids that wil be used in a product icon theme when styling an icon.

Product icon ids are component specific and are defined in the component itself, e.g. as done here:
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/terminalIcons.ts#L6

export const newTerminalIcon = registerIcon('terminal-new', Codicon.add, localize('newTerminalIcon', 'Icon for creating a new terminal instance.'));

This defines a new product icon terminal-new, and uses the codicon 'add' icon as the default icon.

When using these icons in code, terminalicons.newTerminalIcon must be used (or in labels by the id terminal-new).
We never want to reference Codicon.add in components, unless for the default in registerIcon.

Some years ago, all our components directly referenced codicons and their ids. When adding icon theming support we added this indirection and I and @misolori migrated most components, including terminal. But given the huge number of icon references that work is still not complete and there are still plenty of references to Codicon. That's why a codicon and a product icon (ThemeIcon) still have the same API and we don't enforce this with the compiler. Also there are some codicon aliases that have component specific names. We can't clean up the aliases in order to not break existing code in extensions. Eventually no one should use there anymore.

  • please do not reference Codicon directly anymore unless in registerIcon
  • please follow the pattern as seen in terminalIcons
  • please don't add component specific Codicon aliases

FYI @misolori @daviddossett

@Tyriar
Copy link
Member

Tyriar commented Aug 24, 2022

@aeschli FYI I was following what seemed to be the thing to do as demonstrated by the debug- icons.

public static readonly debugBreakpoint = new Codicon('debug-breakpoint', Codicon.circleFilled.definition);
public static readonly debugBreakpointDisabled = new Codicon('debug-breakpoint-disabled', Codicon.circleFilled.definition);
public static readonly debugHint = new Codicon('debug-hint', Codicon.circleFilled.definition);

Could we remove those and similar examples and/or add a @deprecated comment with this guidance?

@aeschli aeschli added the verified Verification succeeded label Aug 25, 2022
@aeschli
Copy link
Contributor Author

aeschli commented Aug 25, 2022

Good point, we should clean these up. The breakpoint- codicons have been around from old times before we did the product icons. There are product icon registration under the same name

regular: registerIcon('debug-breakpoint', Codicon.debugBreakpoint, localize('debugBreakpoint', 'Icon for breakpoints.')),
, so we can remove the codicons that are just aliases, and give the others a different name, to avoid confusion.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants