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 QuickPickItem to have file icons #232439

Open
karthiknadig opened this issue Oct 28, 2024 · 7 comments
Open

Allow QuickPickItem to have file icons #232439

karthiknadig opened this issue Oct 28, 2024 · 7 comments
Assignees

Comments

@karthiknadig
Copy link
Member

karthiknadig commented Oct 28, 2024

Currently, there is no explicit way to set the theme icon for items in QuickPickItem, Terminal, TreeViewItem to a specific language Icon.

TreeView supports an indirect way where you need to set resourceUri to a file (like something.py), and iconPath to ThemeIcon.File. This allows core to calculate the icon. But there is no way to say iconPath = new ThemeIcon('python').

Such a feature is not available in QuickPicks or Terminal (iconPath). For QuickPick, the uses cases include selecting a start-up script or set of files for some task. For, Terminal, in python extension we can have dedicated terminal per file, and we would like to show the icon of the file there.

Related: #124363 , #59826

@karthiknadig karthiknadig changed the title Allow languageid in ThemeIcon to use language theme icons Allow languageid as id in ThemeIcon to use language theme icons Oct 28, 2024
@rzhao271 rzhao271 assigned TylerLeonhardt and Tyriar and unassigned rzhao271 Oct 28, 2024
@TylerLeonhardt
Copy link
Member

Martin owns ThemeIcon's... I'll let him drive this one. If you want a separate issue that is specific to QuickPick having a resourceUri like Trees, please create one and assign that to me.

@aeschli
Copy link
Contributor

aeschli commented Oct 29, 2024

There are two different types of icons:

  • file icons: they are defined by the current file icon theme. There are file icon themes that don't show icons, and there are file icon themes that show the same icon for all files. Maybe there's an icon for python in there, maybe there are multiple as associations are based on file name, file extension and folder name and language
  • product icons: A set of named icons. The ones you can reference in ThemeIcon

If your goal is to have the same icon as in the explorer or editor title: then use ThemeIcon.FILE and set a resource. We need a resource name for that given the multiple ways that associations work. The resource doesn't have to exist.

If you want to have a Python icon that is always available, but might not match what's in the explorer:
Ask for a new codicon for an icon called 'Python'

There's one thing we could do. Language providers have a way to contribute a default icon. It is used as a file icon if a file icon theme shows icons does not define an icon for a language. We could also register that one as a product icon.

  • Only very few languages do that. Basically only exotic languages that are unknown to most file icon themes
  • That icon will in the most cases not match the icon from file icon theme.

@karthiknadig
Copy link
Member Author

For Quickpick, Terminal, I want the file icons, that would address the issue that I have.

@aeschli
Copy link
Contributor

aeschli commented Nov 5, 2024

Ok, then assigning this issue to @TylerLeonhardt for Quick Pick...

@aeschli aeschli changed the title Allow languageid as id in ThemeIcon to use language theme icons Allow QuickPickItem to have file icons Nov 5, 2024
@aeschli aeschli assigned TylerLeonhardt and unassigned aeschli Nov 5, 2024
@TylerLeonhardt
Copy link
Member

Based on the response @aeschli doesn't think we should allow the language id in the ThemeIcon and Karthik is satisfied with that answer so long as we address the gaps in QuickPick and Terminal APIs.

I already have a quick pick one #59826

@karthiknadig were you able to find a Terminal one?

If not, can you open one?
If so, or once that's opened, then we can mark this as a dupe of those, I think.

@karthiknadig
Copy link
Member Author

@TylerLeonhardt Created #233354 for Terminals

@Tyriar
Copy link
Member

Tyriar commented Nov 7, 2024

Should we close this in favor of #59826?

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

No branches or pull requests

5 participants