Skip to content

Commit

Permalink
Add extra segment for file-name priority
Browse files Browse the repository at this point in the history
Make `folder/*.ext` selector lower priority than `file.ext`.
  • Loading branch information
SNDST00M: M.U.N.I.N authored and SNDST00M: M.U.N.I.N committed Jan 4, 2022
1 parent 09374ea commit ff306e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/vs/editor/common/services/getIconClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function getIconClasses(modelService: IModelService, languageService: ILa
// Name & Extension(s)
if (name) {
classes.push(`${name}-name-file-icon`);
classes.push(`name-file-icon`); // extra segment to increase file-name score
// Avoid doing an explosive combination of extensions for very long filenames
// (most file systems do not allow files > 255 length) with lots of `.` characters
// https://github.com/microsoft/vscode/issues/116199
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
selectors.push(`.${escapeCSS(directoryName.toLowerCase())}-name-dir-icon`);
fileName = fileIconDirectoryRegexMatch[2];
}
fileName = fileName.toLowerCase();
fileName = fileName.toLowerCase(); // extra segment to increase file-name score
selectors.push(`.${escapeCSS(fileName)}-name-file-icon`);
selectors.push('.name-file-icon');
let segments = fileName.split('.');
if (segments.length) {
for (let i = 1; i < segments.length; i++) {
Expand Down

0 comments on commit ff306e7

Please sign in to comment.