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

[icon-themes] Support for folder / directory names in file associations (Icon themes) #136656

Closed
ghost opened this issue Nov 8, 2021 · 6 comments · Fixed by #140079
Closed

[icon-themes] Support for folder / directory names in file associations (Icon themes) #136656

ghost opened this issue Nov 8, 2021 · 6 comments · Fixed by #140079
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders on-testplan themes Color theme issues
Milestone

Comments

@ghost
Copy link

ghost commented Nov 8, 2021

#12493 specifies globs in file associations, but I'd really like to match based on folder name as well.

For example, Ember uses config/environment.js which in a perfect world the File Icon API would consume into:

<div class="monaco-icon-label file-icon environment.js-name-file-icon js-ext-file-icon ext-file-icon config-dir-file-icon javascript-lang-file-icon file-icon">
<!-- ::before -->
</div>

File icon packs would then just do this: { "config/environment.js": "../icons/ember.svg" }.

@aeschli
Copy link
Contributor

aeschli commented Nov 9, 2021

Good suggestion. Happy to take a PR.

@aeschli aeschli added themes Color theme issues feature-request Request for new features or functionality labels Nov 9, 2021
@aeschli aeschli added this to the Backlog milestone Nov 9, 2021
@aeschli aeschli added the help wanted Issues identified as good community contribution opportunities label Nov 9, 2021
@ghost
Copy link
Author

ghost commented Nov 13, 2021

I can start work on this STAT, which files need updating?

https://github.com/microsoft/vscode/blob/1.62.2/src/vs/editor/common/services/getIconClasses.ts

@ghost ghost changed the title [icon-themes] Support for folder/directory names in file associations (Icon themes) [icon-themes] Support for folder / directory names in file associations (Icon themes) Nov 13, 2021
@aeschli
Copy link
Contributor

aeschli commented Nov 15, 2021

Yes that one hopeful is used by everyone.
The css rules are created in https://github.com/microsoft/vscode/blob/main/src/vs/workbench/services/themes/browser/fileIconThemeData.ts

@ghost
Copy link
Author

ghost commented Nov 15, 2021

We do need to agree for a syntax on this - is <directory>/ prefix okay for all cases - folderNames folderNamesExpanded fileExtensions fileNames?

@aeschli
Copy link
Contributor

aeschli commented Nov 16, 2021

I'm fine with allowing it for all.
One thing to pay attention to is what happens if there are multiple associations that match a resource name/ path.
The current rule is:
A file name match is preferred over a file extension match which is preferred over a language match.
This is implemented by the number of css classes that are matched.

The question is how folder matches are treated:

  • folder/name is stronger than just name
  • folder/extension is stronger that extension, but does it beat name?

@ghost
Copy link
Author

ghost commented Dec 12, 2021

I also do want to propose a "./" prefix for root files like Heroku's ./app.json. Is there a way to implement that?

@aeschli aeschli added the verification-needed Verification of issue is requested label Feb 3, 2022
@aeschli aeschli added on-testplan and removed verification-needed Verification of issue is requested labels Feb 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders on-testplan themes Color theme issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@aeschli and others