@codingame/monaco-vscode-theme-service-override 1.82.4 → 1.82.5-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/theme.d.ts +7 -0
- package/theme.js +27 -0
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +355 -0
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +292 -0
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +744 -0
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +866 -0
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +267 -0
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +305 -0
- package/vscode/src/vs/workbench/services/themes/common/plistParser.js +440 -0
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +96 -0
- package/vscode/src/vs/workbench/services/themes/common/textMateScopeMatcher.js +121 -0
- package/vscode/src/vs/workbench/services/themes/common/themeCompatibility.js +68 -0
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +374 -0
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +256 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '
|
|
1
|
+
export { IThemeExtensionPoint, default } from './theme.js';
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '
|
|
1
|
+
export { default } from './theme.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-theme-service-override",
|
|
3
|
-
"version": "1.82.
|
|
3
|
+
"version": "1.82.5-next.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.82.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.82.5-next.0",
|
|
22
22
|
"monaco-editor": "0.43.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/theme.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IThemeExtensionPoint } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
|
|
2
|
+
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
|
+
|
|
4
|
+
type PartialIThemeExtensionPoint = Partial<IThemeExtensionPoint> & Pick<IThemeExtensionPoint, 'id' | 'path'>;
|
|
5
|
+
declare function getServiceOverride(): IEditorOverrideServices;
|
|
6
|
+
|
|
7
|
+
export { type PartialIThemeExtensionPoint as IThemeExtensionPoint, getServiceOverride as default };
|
package/theme.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WorkbenchThemeService } from './vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js';
|
|
2
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
3
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
4
|
+
import getServiceOverride$1 from 'vscode/service-override/files';
|
|
5
|
+
|
|
6
|
+
class StandaloneWorkbenchThemeService extends WorkbenchThemeService {
|
|
7
|
+
registerEditorContainer() {
|
|
8
|
+
return {
|
|
9
|
+
dispose() { }
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
setTheme(themeName) {
|
|
13
|
+
void this.getColorThemes().then(themes => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
void this.setColorTheme(themes.find(theme => theme.settingsId === themeName) ?? themeName, 8 );
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getServiceOverride() {
|
|
21
|
+
return {
|
|
22
|
+
...getServiceOverride$1(),
|
|
23
|
+
[( IThemeService.toString())]: new SyncDescriptor(StandaloneWorkbenchThemeService, [], false)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { getServiceOverride as default };
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import * as path from 'monaco-editor/esm/vs/base/common/path.js';
|
|
3
|
+
import * as resources from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
4
|
+
import * as json from 'monaco-editor/esm/vs/base/common/json.js';
|
|
5
|
+
import { ExtensionData } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
|
|
6
|
+
import { getParseErrorMessage } from 'vscode/vscode/vs/base/common/jsonErrorMessages';
|
|
7
|
+
import { asCSSUrl } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
8
|
+
|
|
9
|
+
class FileIconThemeData {
|
|
10
|
+
static { this.STORAGE_KEY = 'iconThemeData'; }
|
|
11
|
+
constructor(id, label, settingsId) {
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.label = label;
|
|
14
|
+
this.settingsId = settingsId;
|
|
15
|
+
this.isLoaded = false;
|
|
16
|
+
this.hasFileIcons = false;
|
|
17
|
+
this.hasFolderIcons = false;
|
|
18
|
+
this.hidesExplorerArrows = false;
|
|
19
|
+
}
|
|
20
|
+
ensureLoaded(themeLoader) {
|
|
21
|
+
return !this.isLoaded ? this.load(themeLoader) : Promise.resolve(this.styleSheetContent);
|
|
22
|
+
}
|
|
23
|
+
reload(themeLoader) {
|
|
24
|
+
return this.load(themeLoader);
|
|
25
|
+
}
|
|
26
|
+
load(themeLoader) {
|
|
27
|
+
return themeLoader.load(this);
|
|
28
|
+
}
|
|
29
|
+
static fromExtensionTheme(iconTheme, iconThemeLocation, extensionData) {
|
|
30
|
+
const id = extensionData.extensionId + '-' + iconTheme.id;
|
|
31
|
+
const label = iconTheme.label || path.basename(iconTheme.path);
|
|
32
|
+
const settingsId = iconTheme.id;
|
|
33
|
+
const themeData = ( new FileIconThemeData(id, label, settingsId));
|
|
34
|
+
themeData.description = iconTheme.description;
|
|
35
|
+
themeData.location = iconThemeLocation;
|
|
36
|
+
themeData.extensionData = extensionData;
|
|
37
|
+
themeData.watch = iconTheme._watch;
|
|
38
|
+
themeData.isLoaded = false;
|
|
39
|
+
return themeData;
|
|
40
|
+
}
|
|
41
|
+
static { this._noIconTheme = null; }
|
|
42
|
+
static get noIconTheme() {
|
|
43
|
+
let themeData = FileIconThemeData._noIconTheme;
|
|
44
|
+
if (!themeData) {
|
|
45
|
+
themeData = FileIconThemeData._noIconTheme = ( new FileIconThemeData('', '', null));
|
|
46
|
+
themeData.hasFileIcons = false;
|
|
47
|
+
themeData.hasFolderIcons = false;
|
|
48
|
+
themeData.hidesExplorerArrows = false;
|
|
49
|
+
themeData.isLoaded = true;
|
|
50
|
+
themeData.extensionData = undefined;
|
|
51
|
+
themeData.watch = false;
|
|
52
|
+
}
|
|
53
|
+
return themeData;
|
|
54
|
+
}
|
|
55
|
+
static createUnloadedTheme(id) {
|
|
56
|
+
const themeData = ( new FileIconThemeData(id, '', '__' + id));
|
|
57
|
+
themeData.isLoaded = false;
|
|
58
|
+
themeData.hasFileIcons = false;
|
|
59
|
+
themeData.hasFolderIcons = false;
|
|
60
|
+
themeData.hidesExplorerArrows = false;
|
|
61
|
+
themeData.extensionData = undefined;
|
|
62
|
+
themeData.watch = false;
|
|
63
|
+
return themeData;
|
|
64
|
+
}
|
|
65
|
+
static fromStorageData(storageService) {
|
|
66
|
+
const input = storageService.get(FileIconThemeData.STORAGE_KEY, 0 );
|
|
67
|
+
if (!input) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const data = JSON.parse(input);
|
|
72
|
+
const theme = ( new FileIconThemeData('', '', null));
|
|
73
|
+
for (const key in data) {
|
|
74
|
+
switch (key) {
|
|
75
|
+
case 'id':
|
|
76
|
+
case 'label':
|
|
77
|
+
case 'description':
|
|
78
|
+
case 'settingsId':
|
|
79
|
+
case 'styleSheetContent':
|
|
80
|
+
case 'hasFileIcons':
|
|
81
|
+
case 'hidesExplorerArrows':
|
|
82
|
+
case 'hasFolderIcons':
|
|
83
|
+
case 'watch':
|
|
84
|
+
theme[key] = data[key];
|
|
85
|
+
break;
|
|
86
|
+
case 'location':
|
|
87
|
+
break;
|
|
88
|
+
case 'extensionData':
|
|
89
|
+
theme.extensionData = ExtensionData.fromJSONObject(data.extensionData);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return theme;
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
toStorage(storageService) {
|
|
100
|
+
const data = JSON.stringify({
|
|
101
|
+
id: this.id,
|
|
102
|
+
label: this.label,
|
|
103
|
+
description: this.description,
|
|
104
|
+
settingsId: this.settingsId,
|
|
105
|
+
styleSheetContent: this.styleSheetContent,
|
|
106
|
+
hasFileIcons: this.hasFileIcons,
|
|
107
|
+
hasFolderIcons: this.hasFolderIcons,
|
|
108
|
+
hidesExplorerArrows: this.hidesExplorerArrows,
|
|
109
|
+
extensionData: ExtensionData.toJSONObject(this.extensionData),
|
|
110
|
+
watch: this.watch
|
|
111
|
+
});
|
|
112
|
+
storageService.store(FileIconThemeData.STORAGE_KEY, data, 0 , 1 );
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
class FileIconThemeLoader {
|
|
116
|
+
constructor(fileService, languageService) {
|
|
117
|
+
this.fileService = fileService;
|
|
118
|
+
this.languageService = languageService;
|
|
119
|
+
}
|
|
120
|
+
load(data) {
|
|
121
|
+
if (!data.location) {
|
|
122
|
+
return Promise.resolve(data.styleSheetContent);
|
|
123
|
+
}
|
|
124
|
+
return this.loadIconThemeDocument(data.location).then(iconThemeDocument => {
|
|
125
|
+
const result = this.processIconThemeDocument(data.id, data.location, iconThemeDocument);
|
|
126
|
+
data.styleSheetContent = result.content;
|
|
127
|
+
data.hasFileIcons = result.hasFileIcons;
|
|
128
|
+
data.hasFolderIcons = result.hasFolderIcons;
|
|
129
|
+
data.hidesExplorerArrows = result.hidesExplorerArrows;
|
|
130
|
+
data.isLoaded = true;
|
|
131
|
+
return data.styleSheetContent;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
loadIconThemeDocument(location) {
|
|
135
|
+
return this.fileService.readExtensionResource(location).then((content) => {
|
|
136
|
+
const errors = [];
|
|
137
|
+
const contentValue = json.parse(content, errors);
|
|
138
|
+
if (errors.length > 0) {
|
|
139
|
+
return Promise.reject(( new Error(( nls.localize(
|
|
140
|
+
'error.cannotparseicontheme',
|
|
141
|
+
"Problems parsing file icons file: {0}",
|
|
142
|
+
( errors.map(e => getParseErrorMessage(e.error))).join(', ')
|
|
143
|
+
)))));
|
|
144
|
+
}
|
|
145
|
+
else if (json.getNodeType(contentValue) !== 'object') {
|
|
146
|
+
return Promise.reject(( new Error(( nls.localize(
|
|
147
|
+
'error.invalidformat',
|
|
148
|
+
"Invalid format for file icons theme file: Object expected."
|
|
149
|
+
)))));
|
|
150
|
+
}
|
|
151
|
+
return Promise.resolve(contentValue);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
processIconThemeDocument(id, iconThemeDocumentLocation, iconThemeDocument) {
|
|
155
|
+
const result = { content: '', hasFileIcons: false, hasFolderIcons: false, hidesExplorerArrows: !!iconThemeDocument.hidesExplorerArrows };
|
|
156
|
+
let hasSpecificFileIcons = false;
|
|
157
|
+
if (!iconThemeDocument.iconDefinitions) {
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
const selectorByDefinitionId = {};
|
|
161
|
+
const coveredLanguages = {};
|
|
162
|
+
const iconThemeDocumentLocationDirname = resources.dirname(iconThemeDocumentLocation);
|
|
163
|
+
function resolvePath(path) {
|
|
164
|
+
return resources.joinPath(iconThemeDocumentLocationDirname, path);
|
|
165
|
+
}
|
|
166
|
+
function collectSelectors(associations, baseThemeClassName) {
|
|
167
|
+
function addSelector(selector, defId) {
|
|
168
|
+
if (defId) {
|
|
169
|
+
let list = selectorByDefinitionId[defId];
|
|
170
|
+
if (!list) {
|
|
171
|
+
list = selectorByDefinitionId[defId] = [];
|
|
172
|
+
}
|
|
173
|
+
list.push(selector);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (associations) {
|
|
177
|
+
let qualifier = '.show-file-icons';
|
|
178
|
+
if (baseThemeClassName) {
|
|
179
|
+
qualifier = baseThemeClassName + ' ' + qualifier;
|
|
180
|
+
}
|
|
181
|
+
const expanded = '.monaco-tl-twistie.collapsible:not(.collapsed) + .monaco-tl-contents';
|
|
182
|
+
if (associations.folder) {
|
|
183
|
+
addSelector(`${qualifier} .folder-icon::before`, associations.folder);
|
|
184
|
+
result.hasFolderIcons = true;
|
|
185
|
+
}
|
|
186
|
+
if (associations.folderExpanded) {
|
|
187
|
+
addSelector(`${qualifier} ${expanded} .folder-icon::before`, associations.folderExpanded);
|
|
188
|
+
result.hasFolderIcons = true;
|
|
189
|
+
}
|
|
190
|
+
const rootFolder = associations.rootFolder || associations.folder;
|
|
191
|
+
const rootFolderExpanded = associations.rootFolderExpanded || associations.folderExpanded;
|
|
192
|
+
if (rootFolder) {
|
|
193
|
+
addSelector(`${qualifier} .rootfolder-icon::before`, rootFolder);
|
|
194
|
+
result.hasFolderIcons = true;
|
|
195
|
+
}
|
|
196
|
+
if (rootFolderExpanded) {
|
|
197
|
+
addSelector(`${qualifier} ${expanded} .rootfolder-icon::before`, rootFolderExpanded);
|
|
198
|
+
result.hasFolderIcons = true;
|
|
199
|
+
}
|
|
200
|
+
if (associations.file) {
|
|
201
|
+
addSelector(`${qualifier} .file-icon::before`, associations.file);
|
|
202
|
+
result.hasFileIcons = true;
|
|
203
|
+
}
|
|
204
|
+
const folderNames = associations.folderNames;
|
|
205
|
+
if (folderNames) {
|
|
206
|
+
for (const key in folderNames) {
|
|
207
|
+
const selectors = [];
|
|
208
|
+
const name = handleParentFolder(key.toLowerCase(), selectors);
|
|
209
|
+
selectors.push(`.${escapeCSS(name)}-name-folder-icon`);
|
|
210
|
+
addSelector(`${qualifier} ${selectors.join('')}.folder-icon::before`, folderNames[key]);
|
|
211
|
+
result.hasFolderIcons = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const folderNamesExpanded = associations.folderNamesExpanded;
|
|
215
|
+
if (folderNamesExpanded) {
|
|
216
|
+
for (const key in folderNamesExpanded) {
|
|
217
|
+
const selectors = [];
|
|
218
|
+
const name = handleParentFolder(key.toLowerCase(), selectors);
|
|
219
|
+
selectors.push(`.${escapeCSS(name)}-name-folder-icon`);
|
|
220
|
+
addSelector(`${qualifier} ${expanded} ${selectors.join('')}.folder-icon::before`, folderNamesExpanded[key]);
|
|
221
|
+
result.hasFolderIcons = true;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const languageIds = associations.languageIds;
|
|
225
|
+
if (languageIds) {
|
|
226
|
+
if (!languageIds.jsonc && languageIds.json) {
|
|
227
|
+
languageIds.jsonc = languageIds.json;
|
|
228
|
+
}
|
|
229
|
+
for (const languageId in languageIds) {
|
|
230
|
+
addSelector(`${qualifier} .${escapeCSS(languageId)}-lang-file-icon.file-icon::before`, languageIds[languageId]);
|
|
231
|
+
result.hasFileIcons = true;
|
|
232
|
+
hasSpecificFileIcons = true;
|
|
233
|
+
coveredLanguages[languageId] = true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const fileExtensions = associations.fileExtensions;
|
|
237
|
+
if (fileExtensions) {
|
|
238
|
+
for (const key in fileExtensions) {
|
|
239
|
+
const selectors = [];
|
|
240
|
+
const name = handleParentFolder(key.toLowerCase(), selectors);
|
|
241
|
+
const segments = name.split('.');
|
|
242
|
+
if (segments.length) {
|
|
243
|
+
for (let i = 0; i < segments.length; i++) {
|
|
244
|
+
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
|
245
|
+
}
|
|
246
|
+
selectors.push('.ext-file-icon');
|
|
247
|
+
}
|
|
248
|
+
addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileExtensions[key]);
|
|
249
|
+
result.hasFileIcons = true;
|
|
250
|
+
hasSpecificFileIcons = true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const fileNames = associations.fileNames;
|
|
254
|
+
if (fileNames) {
|
|
255
|
+
for (const key in fileNames) {
|
|
256
|
+
const selectors = [];
|
|
257
|
+
const fileName = handleParentFolder(key.toLowerCase(), selectors);
|
|
258
|
+
selectors.push(`.${escapeCSS(fileName)}-name-file-icon`);
|
|
259
|
+
selectors.push('.name-file-icon');
|
|
260
|
+
const segments = fileName.split('.');
|
|
261
|
+
if (segments.length) {
|
|
262
|
+
for (let i = 1; i < segments.length; i++) {
|
|
263
|
+
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
|
|
264
|
+
}
|
|
265
|
+
selectors.push('.ext-file-icon');
|
|
266
|
+
}
|
|
267
|
+
addSelector(`${qualifier} ${selectors.join('')}.file-icon::before`, fileNames[key]);
|
|
268
|
+
result.hasFileIcons = true;
|
|
269
|
+
hasSpecificFileIcons = true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
collectSelectors(iconThemeDocument);
|
|
275
|
+
collectSelectors(iconThemeDocument.light, '.vs');
|
|
276
|
+
collectSelectors(iconThemeDocument.highContrast, '.hc-black');
|
|
277
|
+
collectSelectors(iconThemeDocument.highContrast, '.hc-light');
|
|
278
|
+
if (!result.hasFileIcons && !result.hasFolderIcons) {
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
const showLanguageModeIcons = iconThemeDocument.showLanguageModeIcons === true || (hasSpecificFileIcons && iconThemeDocument.showLanguageModeIcons !== false);
|
|
282
|
+
const cssRules = [];
|
|
283
|
+
const fonts = iconThemeDocument.fonts;
|
|
284
|
+
const fontSizes = ( new Map());
|
|
285
|
+
if (Array.isArray(fonts)) {
|
|
286
|
+
const defaultFontSize = fonts[0].size || '150%';
|
|
287
|
+
fonts.forEach(font => {
|
|
288
|
+
const src = ( font.src.map(l => `${asCSSUrl(resolvePath(l.path))} format('${l.format}')`)).join(', ');
|
|
289
|
+
cssRules.push(`@font-face { src: ${src}; font-family: '${font.id}'; font-weight: ${font.weight}; font-style: ${font.style}; font-display: block; }`);
|
|
290
|
+
if (font.size !== undefined && font.size !== defaultFontSize) {
|
|
291
|
+
fontSizes.set(font.id, font.size);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
cssRules.push(`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: '${fonts[0].id}'; font-size: ${defaultFontSize}; }`);
|
|
295
|
+
}
|
|
296
|
+
for (const defId in selectorByDefinitionId) {
|
|
297
|
+
const selectors = selectorByDefinitionId[defId];
|
|
298
|
+
const definition = iconThemeDocument.iconDefinitions[defId];
|
|
299
|
+
if (definition) {
|
|
300
|
+
if (definition.iconPath) {
|
|
301
|
+
cssRules.push(`${selectors.join(', ')} { content: ' '; background-image: ${asCSSUrl(resolvePath(definition.iconPath))}; }`);
|
|
302
|
+
}
|
|
303
|
+
else if (definition.fontCharacter || definition.fontColor) {
|
|
304
|
+
const body = [];
|
|
305
|
+
if (definition.fontColor) {
|
|
306
|
+
body.push(`color: ${definition.fontColor};`);
|
|
307
|
+
}
|
|
308
|
+
if (definition.fontCharacter) {
|
|
309
|
+
body.push(`content: '${definition.fontCharacter}';`);
|
|
310
|
+
}
|
|
311
|
+
const fontSize = definition.fontSize ?? (definition.fontId ? fontSizes.get(definition.fontId) : undefined);
|
|
312
|
+
if (fontSize) {
|
|
313
|
+
body.push(`font-size: ${fontSize};`);
|
|
314
|
+
}
|
|
315
|
+
if (definition.fontId) {
|
|
316
|
+
body.push(`font-family: ${definition.fontId};`);
|
|
317
|
+
}
|
|
318
|
+
if (showLanguageModeIcons) {
|
|
319
|
+
body.push(`background-image: unset;`);
|
|
320
|
+
}
|
|
321
|
+
cssRules.push(`${selectors.join(', ')} { ${body.join(' ')} }`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (showLanguageModeIcons) {
|
|
326
|
+
for (const languageId of this.languageService.getRegisteredLanguageIds()) {
|
|
327
|
+
if (!coveredLanguages[languageId]) {
|
|
328
|
+
const icon = this.languageService.getIcon(languageId);
|
|
329
|
+
if (icon) {
|
|
330
|
+
const selector = `.show-file-icons .${escapeCSS(languageId)}-lang-file-icon.file-icon::before`;
|
|
331
|
+
cssRules.push(`${selector} { content: ' '; background-image: ${asCSSUrl(icon.dark)}; }`);
|
|
332
|
+
cssRules.push(`.vs ${selector} { content: ' '; background-image: ${asCSSUrl(icon.light)}; }`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
result.content = cssRules.join('\n');
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function handleParentFolder(key, selectors) {
|
|
342
|
+
const lastIndexOfSlash = key.lastIndexOf('/');
|
|
343
|
+
if (lastIndexOfSlash >= 0) {
|
|
344
|
+
const parentFolder = key.substring(0, lastIndexOfSlash);
|
|
345
|
+
selectors.push(`.${escapeCSS(parentFolder)}-name-dir-icon`);
|
|
346
|
+
return key.substring(lastIndexOfSlash + 1);
|
|
347
|
+
}
|
|
348
|
+
return key;
|
|
349
|
+
}
|
|
350
|
+
function escapeCSS(str) {
|
|
351
|
+
str = str.replace(/[\11\12\14\15\40]/g, '/');
|
|
352
|
+
return window.CSS.escape(str);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export { FileIconThemeData, FileIconThemeLoader };
|