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

feat: support iconThemes definitions for root folders #195319

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/vs/editor/common/services/getIconClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ export function getIconClasses(modelService: IModelService, languageService: ILa
}
}

// Root Folders
if (fileKind === FileKind.ROOT_FOLDER) {
classes.push(`${name}-root-name-folder-icon`);
}

// Folders
if (fileKind === FileKind.FOLDER) {
else if (fileKind === FileKind.FOLDER) {
classes.push(`${name}-name-folder-icon`);
}

Expand Down
17 changes: 17 additions & 0 deletions src/vs/workbench/services/themes/browser/fileIconThemeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ interface IconsAssociation {
folderExpanded?: string;
rootFolder?: string;
rootFolderExpanded?: string;
rootFolderNames?: { [folderName: string]: string };
rootFolderNamesExpanded?: { [folderName: string]: string };
folderNames?: { [folderName: string]: string };
folderNamesExpanded?: { [folderName: string]: string };
fileExtensions?: { [extension: string]: string };
Expand Down Expand Up @@ -309,6 +311,21 @@ export class FileIconThemeLoader {
}
}

const rootFolderNames = associations.rootFolderNames;
if (rootFolderNames) {
for (const key in rootFolderNames) {
addSelector(`${qualifier} .${escapeCSS(key)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNames[key]);
result.hasFolderIcons = true;
}
}
const rootFolderNamesExpanded = associations.rootFolderNamesExpanded;
if (rootFolderNamesExpanded) {
for (const key in rootFolderNamesExpanded) {
addSelector(`${qualifier} ${expanded} .${escapeCSS(key)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNamesExpanded[key]);
result.hasFolderIcons = true;
}
}

const languageIds = associations.languageIds;
if (languageIds) {
if (!languageIds.jsonc && languageIds.json) {
Expand Down
16 changes: 16 additions & 0 deletions src/vs/workbench/services/themes/common/fileIconThemeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ const schema: IJSONSchema = {
description: nls.localize('schema.file', 'The default file icon, shown for all files that don\'t match any extension, filename or language id.')

},
rootFolderNames: {
type: 'object',
description: nls.localize('schema.rootFolderNames', 'Associates root folder names to icons. The object key is the folder name, not including any path segments. No patterns or wildcards are allowed. Folder name matching is case insensitive.'),
additionalProperties: {
type: 'string',
description: nls.localize('schema.folderName', 'The ID of the icon definition for the association.')
}
},
rootFolderNamesExpanded: {
type: 'object',
description: nls.localize('schema.rootFolderNamesExpanded', 'Associates root folder names to icons for expanded folders. The object key is the folder name, not including any path segments. No patterns or wildcards are allowed. Folder name matching is case insensitive.'),
additionalProperties: {
type: 'string',
description: nls.localize('schema.folderNameExpanded', 'The ID of the icon definition for the association.')
}
},
folderNames: {
type: 'object',
description: nls.localize('schema.folderNames', 'Associates folder names to icons. The object key is the folder name, not including any path segments. No patterns or wildcards are allowed. Folder name matching is case insensitive.'),
Expand Down
Loading