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

Codicon color and URI support to TerminalOptions #13413

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dhuebner
Copy link
Contributor

This is a copy of the original PR #12861
First commit was cherry picked from FernandoAscencio@ba3dda2
In the second commit, I applied the suggested changed from the original PR.

The original description below

What it does

Closes #12074

This commit adds URI and { light, dark } support for terminal icons.
This commit adds ColorTheme support for ThemeIcons
Support for ExtensionTerminalOptions#iconPath

How to test

Open Theia
Install from VSIX the test extension
Check the result follow VSCode test results seen below:

Review checklist

Reminder for reviewers

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of initial high-level comments.

packages/terminal/src/browser/base/terminal-widget.ts Outdated Show resolved Hide resolved
const iconClass = getIconUris(options.iconPath);
if (iconClass) {
return MonacoThemeIcon.asClassName(iconClass);
export function getIconClass(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The definition of the icon in the TerminalOptions is basically the same as in the QuickInputItem. Can't we reuse the same logic for transferring and and resolving icons here? It would make sense (IMO) to solve this the same way everywhere it applies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsmaeder
I think it is a good idea to have a utility that we can re-use. Is it something we can address in a separate PR?
Regarding QuickInputItem, I can't find any related code around this name, or do you mean QuickPickItem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QuickPickItem is what I meant. See quick-open.ts, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing stuff in a separate PR is fine with me, as long as we have a clear timeline on when it's going to happen. I wouldn't just want to "throw it on the pile".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now support the quick pick iconPath property.

@@ -306,6 +316,28 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
this.term.options.fastScrollSensitivity = this.preferences.get('terminal.integrated.fastScrollSensitivity');
}

protected isTerminalAnsiColor(color: string): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the icon is not in the terminal, but in the widget title. Why would we go through the terminal theme service here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsmaeder
I'm not quite sure what you mean. But I think in this function the author checks if the configured color is one of the predefined colors from packages/terminal/src/browser/terminal-theme-service.ts that are preconfigured in terminalAnsiColorMap.
What would you suggest to change here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we care whether this is a in the terminal-theme-service? The color is the color of a ThemeIcon in theia.d.ts. That should go through the regular color registry like with the QuickInputItem stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is now using the regular color registry.

@JonasHelming JonasHelming removed the request for review from rschnekenbu March 22, 2024 07:46
@dhuebner
Copy link
Contributor Author

@tsmaeder
Thanks for your re-view, I will have a look today.

@tsmaeder
Copy link
Contributor

@dhuebner the license check fails. Do we need an ip ticket here?

@dhuebner
Copy link
Contributor Author

@tsmaeder
It hard to say for me what exactly fails from reading the error log.
The original PR, however, didn't fail #12861
And I added no additional dependencies.

@rschnekenbu
Copy link
Contributor

@dhuebner, there was a message yesterday from Thomas on Theia dev list about those IP checks failing. You may rebase on top of master, that should fix the issue. #13524 is the PR fixing the issue.

FernandoAscencio and others added 4 commits May 27, 2024 13:50
Partial close of 12074

- This commit adds URI and { light, dark } support for terminal icons.
- This commit adds ColorTheme support for ThemeIcons
- Support for `ExtensionTerminalOptions#iconPath`

Signed-Off-By: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
(cherry picked from commit ba3dda2)
@msujew
Copy link
Member

msujew commented May 27, 2024

@dhuebner @tsmaeder I've updated the PR myself. I've added support for custom icons for quick pick items and quick pick buttons. You can find an example plugin for that here. Simply use the Quick Input Samples command. Use the multiStepInput option to test that the button icons work as expected. With that I was able to align the icon code of terminals and quick picks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

vscode: Missing partial icon and color API support for ExtensionTerminalOptions and TerminalOptions
5 participants