-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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 globs in file associations (Icon themes) #12493
Comments
@robertohuertasm works for me:
|
@bpasero I think I didn't explain myself clearly so I've slightly changed the issue's title. I wasn't referring to that kind of file association but the one we discussed in vscode-icons #328. |
@robertohuertasm got it, reopening. |
+1 |
2 similar comments
+1 |
+1 |
+1 |
2 similar comments
+1 |
+1 |
+1 |
+1 |
1 similar comment
+1 |
The latest fashion is to have tests co-located with the src, using a convention such as +1 |
For '.test.js': That already should work, just add that to the extensions table. You can have both js, and test.js in there and we will take the icon of whatever extension whatever matches most. |
For the lua example, why not associate extension lua.txt with lua? |
But the whole point is to have a specific I have tests and regular app files together, but want to be able to visually distinguish the files beyond having to mentally parse the file extension in the tree view. This is a common pattern now, since our tests tool can pick up test files in the src, so we don't need to have a separate My current
|
I added a PR, but just discovered new icons are not in zip. |
+1 |
@amit-srivastava-007 You are welcome to help out with my PR. I'm not a graphic designer and I don't know how to position the icons correctly (ie. centered, then lowered by one pixel). |
+1 |
+1 Want to have different icons for python files |
+1 |
Because this should be a new issue.. |
@aeschli is this still open in the backlog? Is there anything that can be done to help it along? It's been five and a half years. Is it likely to be done? |
We have no plans for implementing this future. It doesn't go well with the current implementation of file icons based on matching CSS rules and would require a rewrite. |
@aeschli Could be a way to specify the extension separator? For example see: material-extensions/vscode-material-icon-theme#1598 A posible solution for that could be change the default separator '.' to another special character like '_' or '-' |
Correct that file icon theme consumption and icon CSS class logic is separate:
File icons would probably suffer an FOUC if the two interacted, because the entire (Take There are two possible approaches and both need new data (
We also would want Proof of concept, // Prefix-matching coalescing globs and non-coalescing wildcard globs
function getIconClassesForSomeGlobs(name) {
// remove ellipsis + chars >=255 to defend against explosive combination
// https://github.com/microsoft/vscode/issues/116199
const dotSegments = name.slice(-255).replace(/\.\.+/g, '').split('.');
const lastDotIndex = dotSegments.length - 1;
const globs = [];
for (let i = 0; i < lastDotIndex; i++) {
const suffix = dotSegments.slice(0, i + 1);
suffix.push(i < lastDotIndex - 1 ? '**' : '*');
globs.push(suffix.join('.'));
const base = dotSegments.slice();
base.splice(i, 1, '*');
globs.push(base.join('.'));
}
return globs;
} This is the // All globs matching a file name, excluding globs with chained `*` segments
function getIconClassesForAllGlobs(name) {
// remove ellipsis + chars >=255 to defend against explosive combination
// https://github.com/microsoft/vscode/issues/116199
const dotSegments = name.slice(-255).replace(/\.\.+/g, '').split('.');
const globs = []
const bitmask = Math.pow(2, dotSegments.length) - 1;
for (let i = 0; i < bitmask; i++) {
let buffer = [];
for (let j = 0; j < dotSegments.length; j++) {
buffer.push(i & Math.pow(2, j) ? dotSegments[j] : '*');
}
globs[i] = buffer.join('.').replace(/(?<=\*)(?:\.\*)+/, '*'); // coalesce chained * filename segments into **
}
return globs;
} |
@aeschli now that this is feasible - run this replit to see - there are two questions here:
Noting here - filenames with 5 or more dot segments are consistently considered "weird" and we're not losing much with the |
You must allow patterns on the icon issue. I guess you think this can be achieved with extensions but there are exceptions. In Golang, test files must end with Golang related test documentation: I want to add a corresponding icon to my go files ending with I'm open to feedback. |
It is possible to do As I understand it, we have (maybe past tense now) a significant blocker:
My suggestion was to generate globs on the CSS service side, and those get targeted in file icon theme.. but this needs the assignee's input (plus core team has other work to do). I threw together code for your use case still - see |
I've implemented the feature at #174286. |
Also affected by this. "material-icon-theme.files.associations": {
"tsconfig.*.json": "tsconfig"
}, "material-icon-theme.files.associations": {
"tsconfig.rollup.json": "tsconfig"
}, |
See vscode-icons #328
This will allow to support a very common scenario which is a filename with small variations depending on environments:
The text was updated successfully, but these errors were encountered: