Skip to content

Commit 272653c

Browse files
authored
polish rootFolderNames (microsoft#196599)
* polish rootFolderNames * add rootFolder / rootFolderExpanded to schema * polish * more schema fixes
1 parent 6e95696 commit 272653c

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

src/vs/workbench/services/themes/browser/fileIconThemeData.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,16 @@ export class FileIconThemeLoader {
314314
const rootFolderNames = associations.rootFolderNames;
315315
if (rootFolderNames) {
316316
for (const key in rootFolderNames) {
317-
addSelector(`${qualifier} .${escapeCSS(key)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNames[key]);
317+
const name = key.toLowerCase();
318+
addSelector(`${qualifier} .${escapeCSS(name)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNames[key]);
318319
result.hasFolderIcons = true;
319320
}
320321
}
321322
const rootFolderNamesExpanded = associations.rootFolderNamesExpanded;
322323
if (rootFolderNamesExpanded) {
323324
for (const key in rootFolderNamesExpanded) {
324-
addSelector(`${qualifier} ${expanded} .${escapeCSS(key)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNamesExpanded[key]);
325+
const name = key.toLowerCase();
326+
addSelector(`${qualifier} ${expanded} .${escapeCSS(name)}-root-name-folder-icon.rootfolder-icon::before`, rootFolderNamesExpanded[key]);
325327
result.hasFolderIcons = true;
326328
}
327329
}

src/vs/workbench/services/themes/common/fileIconThemeSchema.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,28 @@ const schema: IJSONSchema = {
2929
description: nls.localize('schema.file', 'The default file icon, shown for all files that don\'t match any extension, filename or language id.')
3030

3131
},
32+
rootFolder: {
33+
type: 'string',
34+
description: nls.localize('schema.rootFolder', 'The folder icon for collapsed root folders, and if rootFolderExpanded is not set, also for expanded root folders.')
35+
},
36+
rootFolderExpanded: {
37+
type: 'string',
38+
description: nls.localize('schema.rootFolderExpanded', 'The folder icon for expanded root folders. The expanded root folder icon is optional. If not set, the icon defined for root folder will be shown.')
39+
},
3240
rootFolderNames: {
3341
type: 'object',
34-
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.'),
42+
description: nls.localize('schema.rootFolderNames', 'Associates root folder names to icons. The object key is the root folder name. No patterns or wildcards are allowed. Root folder name matching is case insensitive.'),
3543
additionalProperties: {
3644
type: 'string',
3745
description: nls.localize('schema.folderName', 'The ID of the icon definition for the association.')
3846
}
3947
},
4048
rootFolderNamesExpanded: {
4149
type: 'object',
42-
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.'),
50+
description: nls.localize('schema.rootFolderNamesExpanded', 'Associates root folder names to icons for expanded root folders. The object key is the root folder name. No patterns or wildcards are allowed. Root folder name matching is case insensitive.'),
4351
additionalProperties: {
4452
type: 'string',
45-
description: nls.localize('schema.folderNameExpanded', 'The ID of the icon definition for the association.')
53+
description: nls.localize('schema.rootFolderNameExpanded', 'The ID of the icon definition for the association.')
4654
}
4755
},
4856
folderNames: {
@@ -106,6 +114,18 @@ const schema: IJSONSchema = {
106114
folderNamesExpanded: {
107115
$ref: '#/definitions/folderNamesExpanded'
108116
},
117+
rootFolder: {
118+
$ref: '#/definitions/rootFolder'
119+
},
120+
rootFolderExpanded: {
121+
$ref: '#/definitions/rootFolderExpanded'
122+
},
123+
rootFolderNames: {
124+
$ref: '#/definitions/rootFolderNames'
125+
},
126+
rootFolderNamesExpanded: {
127+
$ref: '#/definitions/rootFolderNamesExpanded'
128+
},
109129
fileExtensions: {
110130
$ref: '#/definitions/fileExtensions'
111131
},
@@ -222,6 +242,18 @@ const schema: IJSONSchema = {
222242
folderNamesExpanded: {
223243
$ref: '#/definitions/folderNamesExpanded'
224244
},
245+
rootFolder: {
246+
$ref: '#/definitions/rootFolder'
247+
},
248+
rootFolderExpanded: {
249+
$ref: '#/definitions/rootFolderExpanded'
250+
},
251+
rootFolderNames: {
252+
$ref: '#/definitions/rootFolderNames'
253+
},
254+
rootFolderNamesExpanded: {
255+
$ref: '#/definitions/rootFolderNamesExpanded'
256+
},
225257
fileExtensions: {
226258
$ref: '#/definitions/fileExtensions'
227259
},

0 commit comments

Comments
 (0)