@codingame/monaco-vscode-theme-service-override 1.83.1 → 1.83.3-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/package.json +2 -2
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +6 -9
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +22 -55
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +45 -45
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +24 -35
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +13 -31
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +33 -108
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +8 -20
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +36 -102
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +17 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-theme-service-override",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.3-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.83.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.3-next.0",
|
|
22
22
|
"monaco-editor": "0.44.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -136,17 +136,14 @@ class FileIconThemeLoader {
|
|
|
136
136
|
const errors = [];
|
|
137
137
|
const contentValue = json.parse(content, errors);
|
|
138
138
|
if (errors.length > 0) {
|
|
139
|
-
return Promise.reject(( new Error(
|
|
140
|
-
'error.cannotparseicontheme',
|
|
141
|
-
|
|
142
|
-
( errors.map(e => getParseErrorMessage(e.error))).join(', ')
|
|
143
|
-
)))));
|
|
139
|
+
return Promise.reject(( new Error(
|
|
140
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/fileIconThemeData', 'error.cannotparseicontheme', "Problems parsing file icons file: {0}", ( errors.map(e => getParseErrorMessage(e.error))).join(', '))
|
|
141
|
+
)));
|
|
144
142
|
}
|
|
145
143
|
else if (json.getNodeType(contentValue) !== 'object') {
|
|
146
|
-
return Promise.reject(( new Error(
|
|
147
|
-
'error.invalidformat',
|
|
148
|
-
|
|
149
|
-
)))));
|
|
144
|
+
return Promise.reject(( new Error(
|
|
145
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/fileIconThemeData', 'error.invalidformat', "Invalid format for file icons theme file: Object expected.")
|
|
146
|
+
)));
|
|
150
147
|
}
|
|
151
148
|
return Promise.resolve(contentValue);
|
|
152
149
|
});
|
|
@@ -37,12 +37,7 @@ class ProductIconThemeData {
|
|
|
37
37
|
this.iconThemeDocument = await _loadProductIconThemeDocument(fileService, location, warnings);
|
|
38
38
|
this.isLoaded = true;
|
|
39
39
|
if (warnings.length) {
|
|
40
|
-
logService.error((
|
|
41
|
-
'error.parseicondefs',
|
|
42
|
-
"Problems processing product icons definitions in {0}:\n{1}",
|
|
43
|
-
( location.toString()),
|
|
44
|
-
warnings.join('\n')
|
|
45
|
-
)));
|
|
40
|
+
logService.error(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.parseicondefs', "Problems processing product icons definitions in {0}:\n{1}", ( location.toString()), warnings.join('\n')));
|
|
46
41
|
}
|
|
47
42
|
return this.styleSheetContent;
|
|
48
43
|
}
|
|
@@ -69,7 +64,11 @@ class ProductIconThemeData {
|
|
|
69
64
|
static get defaultTheme() {
|
|
70
65
|
let themeData = ProductIconThemeData._defaultProductIconTheme;
|
|
71
66
|
if (!themeData) {
|
|
72
|
-
themeData = ProductIconThemeData._defaultProductIconTheme = ( new ProductIconThemeData(
|
|
67
|
+
themeData = ProductIconThemeData._defaultProductIconTheme = ( new ProductIconThemeData(
|
|
68
|
+
DEFAULT_PRODUCT_ICON_THEME_ID,
|
|
69
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'defaultTheme', 'Default'),
|
|
70
|
+
ThemeSettingDefaults.PRODUCT_ICON_THEME
|
|
71
|
+
));
|
|
73
72
|
themeData.isLoaded = true;
|
|
74
73
|
themeData.extensionData = undefined;
|
|
75
74
|
themeData.watch = false;
|
|
@@ -155,23 +154,19 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
155
154
|
const parseErrors = [];
|
|
156
155
|
const contentValue = json.parse(content, parseErrors);
|
|
157
156
|
if (parseErrors.length > 0) {
|
|
158
|
-
return Promise.reject(( new Error(
|
|
159
|
-
'error.cannotparseicontheme',
|
|
160
|
-
|
|
161
|
-
( parseErrors.map(e => getParseErrorMessage(e.error))).join(', ')
|
|
162
|
-
)))));
|
|
157
|
+
return Promise.reject(( new Error(
|
|
158
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.cannotparseicontheme', "Problems parsing product icons file: {0}", ( parseErrors.map(e => getParseErrorMessage(e.error))).join(', '))
|
|
159
|
+
)));
|
|
163
160
|
}
|
|
164
161
|
else if (json.getNodeType(contentValue) !== 'object') {
|
|
165
|
-
return Promise.reject(( new Error(
|
|
166
|
-
'error.invalidformat',
|
|
167
|
-
|
|
168
|
-
)))));
|
|
162
|
+
return Promise.reject(( new Error(
|
|
163
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.invalidformat', "Invalid format for product icons theme file: Object expected.")
|
|
164
|
+
)));
|
|
169
165
|
}
|
|
170
166
|
else if (!contentValue.iconDefinitions || !Array.isArray(contentValue.fonts) || !contentValue.fonts.length) {
|
|
171
|
-
return Promise.reject(( new Error(
|
|
172
|
-
'error.missingProperties',
|
|
173
|
-
|
|
174
|
-
)))));
|
|
167
|
+
return Promise.reject(( new Error(
|
|
168
|
+
nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.missingProperties', "Invalid format for product icons theme file: Must contain iconDefinitions and fonts.")
|
|
169
|
+
)));
|
|
175
170
|
}
|
|
176
171
|
const iconThemeDocumentLocationDirname = resources.dirname(location);
|
|
177
172
|
const sanitizedFonts = ( new Map());
|
|
@@ -183,22 +178,14 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
183
178
|
fontWeight = font.weight;
|
|
184
179
|
}
|
|
185
180
|
else {
|
|
186
|
-
warnings.push((
|
|
187
|
-
'error.fontWeight',
|
|
188
|
-
'Invalid font weight in font \'{0}\'. Ignoring setting.',
|
|
189
|
-
font.id
|
|
190
|
-
)));
|
|
181
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.fontWeight', 'Invalid font weight in font \'{0}\'. Ignoring setting.', font.id));
|
|
191
182
|
}
|
|
192
183
|
let fontStyle = undefined;
|
|
193
184
|
if (isString(font.style) && font.style.match(fontStyleRegex)) {
|
|
194
185
|
fontStyle = font.style;
|
|
195
186
|
}
|
|
196
187
|
else {
|
|
197
|
-
warnings.push((
|
|
198
|
-
'error.fontStyle',
|
|
199
|
-
'Invalid font style in font \'{0}\'. Ignoring setting.',
|
|
200
|
-
font.id
|
|
201
|
-
)));
|
|
188
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.fontStyle', 'Invalid font style in font \'{0}\'. Ignoring setting.', font.id));
|
|
202
189
|
}
|
|
203
190
|
const sanitizedSrc = [];
|
|
204
191
|
if (Array.isArray(font.src)) {
|
|
@@ -208,11 +195,7 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
208
195
|
sanitizedSrc.push({ location: iconFontLocation, format: s.format });
|
|
209
196
|
}
|
|
210
197
|
else {
|
|
211
|
-
warnings.push((
|
|
212
|
-
'error.fontSrc',
|
|
213
|
-
'Invalid font source in font \'{0}\'. Ignoring source.',
|
|
214
|
-
font.id
|
|
215
|
-
)));
|
|
198
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.fontSrc', 'Invalid font source in font \'{0}\'. Ignoring source.', font.id));
|
|
216
199
|
}
|
|
217
200
|
}
|
|
218
201
|
}
|
|
@@ -220,19 +203,11 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
220
203
|
sanitizedFonts.set(fontId, { weight: fontWeight, style: fontStyle, src: sanitizedSrc });
|
|
221
204
|
}
|
|
222
205
|
else {
|
|
223
|
-
warnings.push((
|
|
224
|
-
'error.noFontSrc',
|
|
225
|
-
'No valid font source in font \'{0}\'. Ignoring font definition.',
|
|
226
|
-
font.id
|
|
227
|
-
)));
|
|
206
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.noFontSrc', 'No valid font source in font \'{0}\'. Ignoring font definition.', font.id));
|
|
228
207
|
}
|
|
229
208
|
}
|
|
230
209
|
else {
|
|
231
|
-
warnings.push((
|
|
232
|
-
'error.fontId',
|
|
233
|
-
'Missing or invalid font id \'{0}\'. Skipping font definition.',
|
|
234
|
-
font.id
|
|
235
|
-
)));
|
|
210
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.fontId', 'Missing or invalid font id \'{0}\'. Skipping font definition.', font.id));
|
|
236
211
|
}
|
|
237
212
|
}
|
|
238
213
|
const iconDefinitions = ( new Map());
|
|
@@ -247,19 +222,11 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
247
222
|
iconDefinitions.set(iconId, { fontCharacter: definition.fontCharacter, font });
|
|
248
223
|
}
|
|
249
224
|
else {
|
|
250
|
-
warnings.push((
|
|
251
|
-
'error.icon.font',
|
|
252
|
-
'Skipping icon definition \'{0}\'. Unknown font.',
|
|
253
|
-
iconId
|
|
254
|
-
)));
|
|
225
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.icon.font', 'Skipping icon definition \'{0}\'. Unknown font.', iconId));
|
|
255
226
|
}
|
|
256
227
|
}
|
|
257
228
|
else {
|
|
258
|
-
warnings.push((
|
|
259
|
-
'error.icon.fontCharacter',
|
|
260
|
-
'Skipping icon definition \'{0}\'. Unknown fontCharacter.',
|
|
261
|
-
iconId
|
|
262
|
-
)));
|
|
229
|
+
warnings.push(nls.localizeWithPath('vs/workbench/services/themes/browser/productIconThemeData', 'error.icon.fontCharacter', 'Skipping icon definition \'{0}\'. Unknown fontCharacter.', iconId));
|
|
263
230
|
}
|
|
264
231
|
}
|
|
265
232
|
return { iconDefinitions };
|
|
@@ -44,7 +44,7 @@ const fileIconsEnabledClass = 'file-icons-enabled';
|
|
|
44
44
|
const colorThemeRulesClassName = 'contributedColorTheme';
|
|
45
45
|
const fileIconThemeRulesClassName = 'contributedFileIconTheme';
|
|
46
46
|
const productIconThemeRulesClassName = 'contributedProductIconTheme';
|
|
47
|
-
const themingRegistry = (
|
|
47
|
+
const themingRegistry = ( Registry.as(Extensions.ThemingContribution));
|
|
48
48
|
function validateThemeId(theme) {
|
|
49
49
|
switch (theme) {
|
|
50
50
|
case VS_LIGHT_THEME: return `vs ${defaultThemeExtensionId}-themes-light_vs-json`;
|
|
@@ -68,43 +68,43 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
68
68
|
this.hostColorService = hostColorService;
|
|
69
69
|
this.userDataInitializationService = userDataInitializationService;
|
|
70
70
|
this.hasDefaultUpdated = false;
|
|
71
|
-
this.themeExtensionsActivated = (
|
|
71
|
+
this.themeExtensionsActivated = ( new Map());
|
|
72
72
|
this.container = layoutService.container;
|
|
73
|
-
this.settings = (
|
|
74
|
-
this.colorThemeRegistry = (
|
|
75
|
-
this.colorThemeWatcher = (
|
|
76
|
-
this.onColorThemeChange = (
|
|
73
|
+
this.settings = ( new ThemeConfiguration(configurationService));
|
|
74
|
+
this.colorThemeRegistry = ( new ThemeRegistry(colorThemesExtPoint, ColorThemeData.fromExtensionTheme));
|
|
75
|
+
this.colorThemeWatcher = ( new ThemeFileWatcher(fileService, environmentService, this.reloadCurrentColorTheme.bind(this)));
|
|
76
|
+
this.onColorThemeChange = ( new Emitter({ leakWarningThreshold: 400 }));
|
|
77
77
|
this.currentColorTheme = ColorThemeData.createUnloadedTheme('');
|
|
78
|
-
this.colorThemeSequencer = (
|
|
79
|
-
this.fileIconThemeWatcher = (
|
|
78
|
+
this.colorThemeSequencer = ( new Sequencer());
|
|
79
|
+
this.fileIconThemeWatcher = ( new ThemeFileWatcher(
|
|
80
80
|
fileService,
|
|
81
81
|
environmentService,
|
|
82
82
|
this.reloadCurrentFileIconTheme.bind(this)
|
|
83
|
-
))
|
|
84
|
-
this.fileIconThemeRegistry = (
|
|
83
|
+
));
|
|
84
|
+
this.fileIconThemeRegistry = ( new ThemeRegistry(
|
|
85
85
|
fileIconThemesExtPoint,
|
|
86
86
|
FileIconThemeData.fromExtensionTheme,
|
|
87
87
|
true,
|
|
88
88
|
FileIconThemeData.noIconTheme
|
|
89
|
-
))
|
|
90
|
-
this.fileIconThemeLoader = (
|
|
91
|
-
this.onFileIconThemeChange = (
|
|
89
|
+
));
|
|
90
|
+
this.fileIconThemeLoader = ( new FileIconThemeLoader(extensionResourceLoaderService, languageService));
|
|
91
|
+
this.onFileIconThemeChange = ( new Emitter({ leakWarningThreshold: 400 }));
|
|
92
92
|
this.currentFileIconTheme = FileIconThemeData.createUnloadedTheme('');
|
|
93
|
-
this.fileIconThemeSequencer = (
|
|
94
|
-
this.productIconThemeWatcher = (
|
|
93
|
+
this.fileIconThemeSequencer = ( new Sequencer());
|
|
94
|
+
this.productIconThemeWatcher = ( new ThemeFileWatcher(
|
|
95
95
|
fileService,
|
|
96
96
|
environmentService,
|
|
97
97
|
this.reloadCurrentProductIconTheme.bind(this)
|
|
98
|
-
))
|
|
99
|
-
this.productIconThemeRegistry = (
|
|
98
|
+
));
|
|
99
|
+
this.productIconThemeRegistry = ( new ThemeRegistry(
|
|
100
100
|
productIconThemesExtPoint,
|
|
101
101
|
ProductIconThemeData.fromExtensionTheme,
|
|
102
102
|
true,
|
|
103
103
|
ProductIconThemeData.defaultTheme
|
|
104
|
-
))
|
|
105
|
-
this.onProductIconThemeChange = (
|
|
104
|
+
));
|
|
105
|
+
this.onProductIconThemeChange = ( new Emitter());
|
|
106
106
|
this.currentProductIconTheme = ProductIconThemeData.createUnloadedTheme('');
|
|
107
|
-
this.productIconThemeSequencer = (
|
|
107
|
+
this.productIconThemeSequencer = ( new Sequencer());
|
|
108
108
|
let themeData = ColorThemeData.fromStorageData(this.storageService);
|
|
109
109
|
const colorThemeSetting = this.settings.colorTheme;
|
|
110
110
|
if (themeData && colorThemeSetting !== themeData.settingsId && this.settings.isDefaultColorTheme()) {
|
|
@@ -147,7 +147,7 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
147
147
|
function updateAll() {
|
|
148
148
|
codiconStyleSheet.textContent = iconsStyleSheet.getCSS();
|
|
149
149
|
}
|
|
150
|
-
const delayer = (
|
|
150
|
+
const delayer = ( new RunOnceScheduler(updateAll, 0));
|
|
151
151
|
iconsStyleSheet.onDidChange(() => delayer.schedule());
|
|
152
152
|
delayer.schedule();
|
|
153
153
|
}
|
|
@@ -264,11 +264,11 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
264
264
|
await this.setColorTheme(prevColorId, 'auto');
|
|
265
265
|
prevColorId = undefined;
|
|
266
266
|
}
|
|
267
|
-
else if ((
|
|
267
|
+
else if (( event.added.some(t => t.settingsId === this.currentColorTheme.settingsId))) {
|
|
268
268
|
await this.reloadCurrentColorTheme();
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
else if ((
|
|
271
|
+
else if (( event.removed.some(t => t.settingsId === this.currentColorTheme.settingsId))) {
|
|
272
272
|
prevColorId = this.currentColorTheme.id;
|
|
273
273
|
const defaultTheme = this.colorThemeRegistry.findThemeBySettingsId(ThemeSettingDefaults.COLOR_THEME_DARK);
|
|
274
274
|
await this.setColorTheme(defaultTheme, 'auto');
|
|
@@ -282,11 +282,11 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
282
282
|
await this.setFileIconTheme(prevFileIconId, 'auto');
|
|
283
283
|
prevFileIconId = undefined;
|
|
284
284
|
}
|
|
285
|
-
else if ((
|
|
285
|
+
else if (( event.added.some(t => t.settingsId === this.currentFileIconTheme.settingsId))) {
|
|
286
286
|
await this.reloadCurrentFileIconTheme();
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
else if ((
|
|
289
|
+
else if (( event.removed.some(t => t.settingsId === this.currentFileIconTheme.settingsId))) {
|
|
290
290
|
prevFileIconId = this.currentFileIconTheme.id;
|
|
291
291
|
await this.setFileIconTheme(DEFAULT_FILE_ICON_THEME_ID, 'auto');
|
|
292
292
|
}
|
|
@@ -299,11 +299,11 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
299
299
|
await this.setProductIconTheme(prevProductIconId, 'auto');
|
|
300
300
|
prevProductIconId = undefined;
|
|
301
301
|
}
|
|
302
|
-
else if ((
|
|
302
|
+
else if (( event.added.some(t => t.settingsId === this.currentProductIconTheme.settingsId))) {
|
|
303
303
|
await this.reloadCurrentProductIconTheme();
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
else if ((
|
|
306
|
+
else if (( event.removed.some(t => t.settingsId === this.currentProductIconTheme.settingsId))) {
|
|
307
307
|
prevProductIconId = this.currentProductIconTheme.id;
|
|
308
308
|
await this.setProductIconTheme(DEFAULT_PRODUCT_ICON_THEME_ID, 'auto');
|
|
309
309
|
}
|
|
@@ -427,7 +427,7 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
427
427
|
return this.applyTheme(themeData, settingsTarget);
|
|
428
428
|
}
|
|
429
429
|
catch (error) {
|
|
430
|
-
throw new Error(nls.
|
|
430
|
+
throw new Error(nls.localizeWithPath('vs/workbench/services/themes/browser/workbenchThemeService', 'error.cannotloadtheme', "Unable to load {0}: {1}", themeData.location?.toString(), error.message));
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
reloadCurrentColorTheme() {
|
|
@@ -462,10 +462,10 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
464
|
updateDynamicCSSRules(themeData) {
|
|
465
|
-
const cssRules = (
|
|
465
|
+
const cssRules = ( new Set());
|
|
466
466
|
const ruleCollector = {
|
|
467
467
|
addRule: (rule) => {
|
|
468
|
-
if (!(
|
|
468
|
+
if (!( cssRules.has(rule))) {
|
|
469
469
|
cssRules.add(rule);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
@@ -476,7 +476,7 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
476
476
|
for (const item of getColorRegistry().getColors()) {
|
|
477
477
|
const color = themeData.getColor(item.id, true);
|
|
478
478
|
if (color) {
|
|
479
|
-
colorVariables.push(`${asCssVariableName(item.id)}: ${(
|
|
479
|
+
colorVariables.push(`${asCssVariableName(item.id)}: ${( color.toString())};`);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
ruleCollector.addRule(`.monaco-workbench { ${colorVariables.join('\n')} }`);
|
|
@@ -697,20 +697,20 @@ let WorkbenchThemeService = class WorkbenchThemeService {
|
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
699
|
};
|
|
700
|
-
WorkbenchThemeService = (
|
|
701
|
-
(
|
|
702
|
-
(
|
|
703
|
-
(
|
|
704
|
-
(
|
|
705
|
-
(
|
|
706
|
-
(
|
|
707
|
-
(
|
|
708
|
-
(
|
|
709
|
-
(
|
|
710
|
-
(
|
|
711
|
-
(
|
|
712
|
-
(
|
|
713
|
-
], WorkbenchThemeService))
|
|
700
|
+
WorkbenchThemeService = ( __decorate([
|
|
701
|
+
( __param(0, IExtensionService)),
|
|
702
|
+
( __param(1, IStorageService)),
|
|
703
|
+
( __param(2, IConfigurationService)),
|
|
704
|
+
( __param(3, ITelemetryService)),
|
|
705
|
+
( __param(4, IBrowserWorkbenchEnvironmentService)),
|
|
706
|
+
( __param(5, IFileService)),
|
|
707
|
+
( __param(6, IExtensionResourceLoaderService)),
|
|
708
|
+
( __param(7, IWorkbenchLayoutService)),
|
|
709
|
+
( __param(8, ILogService)),
|
|
710
|
+
( __param(9, IHostColorSchemeService)),
|
|
711
|
+
( __param(10, IUserDataInitializationService)),
|
|
712
|
+
( __param(11, ILanguageService))
|
|
713
|
+
], WorkbenchThemeService));
|
|
714
714
|
class ThemeFileWatcher {
|
|
715
715
|
constructor(fileService, environmentService, onUpdate) {
|
|
716
716
|
this.fileService = fileService;
|
|
@@ -583,17 +583,14 @@ async function _loadColorTheme(extensionResourceLoaderService, themeLocation, re
|
|
|
583
583
|
const errors = [];
|
|
584
584
|
const contentValue = json.parse(content, errors);
|
|
585
585
|
if (errors.length > 0) {
|
|
586
|
-
return Promise.reject(( new Error(
|
|
587
|
-
'error.cannotparsejson',
|
|
588
|
-
|
|
589
|
-
( errors.map(e => getParseErrorMessage(e.error))).join(', ')
|
|
590
|
-
)))));
|
|
586
|
+
return Promise.reject(( new Error(
|
|
587
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', 'error.cannotparsejson', "Problems parsing JSON theme file: {0}", ( errors.map(e => getParseErrorMessage(e.error))).join(', '))
|
|
588
|
+
)));
|
|
591
589
|
}
|
|
592
590
|
else if (json.getNodeType(contentValue) !== 'object') {
|
|
593
|
-
return Promise.reject(( new Error(
|
|
594
|
-
'error.invalidformat',
|
|
595
|
-
|
|
596
|
-
)))));
|
|
591
|
+
return Promise.reject(( new Error(
|
|
592
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', 'error.invalidformat', "Invalid format for JSON theme file: Object expected.")
|
|
593
|
+
)));
|
|
597
594
|
}
|
|
598
595
|
if (contentValue.include) {
|
|
599
596
|
await _loadColorTheme(extensionResourceLoaderService, resources.joinPath(resources.dirname(themeLocation), contentValue.include), result);
|
|
@@ -606,11 +603,9 @@ async function _loadColorTheme(extensionResourceLoaderService, themeLocation, re
|
|
|
606
603
|
const colors = contentValue.colors;
|
|
607
604
|
if (colors) {
|
|
608
605
|
if (typeof colors !== 'object') {
|
|
609
|
-
return Promise.reject(( new Error(
|
|
610
|
-
{ key: 'error.invalidformat.colors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] },
|
|
611
|
-
|
|
612
|
-
( themeLocation.toString())
|
|
613
|
-
)))));
|
|
606
|
+
return Promise.reject(( new Error(
|
|
607
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', { key: 'error.invalidformat.colors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] }, "Problem parsing color theme file: {0}. Property 'colors' is not of type 'object'.", ( themeLocation.toString()))
|
|
608
|
+
)));
|
|
614
609
|
}
|
|
615
610
|
for (const colorId in colors) {
|
|
616
611
|
const colorHex = colors[colorId];
|
|
@@ -628,11 +623,9 @@ async function _loadColorTheme(extensionResourceLoaderService, themeLocation, re
|
|
|
628
623
|
await _loadSyntaxTokens(extensionResourceLoaderService, resources.joinPath(resources.dirname(themeLocation), tokenColors), result);
|
|
629
624
|
}
|
|
630
625
|
else {
|
|
631
|
-
return Promise.reject(( new Error(
|
|
632
|
-
{ key: 'error.invalidformat.tokenColors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] },
|
|
633
|
-
|
|
634
|
-
( themeLocation.toString())
|
|
635
|
-
)))));
|
|
626
|
+
return Promise.reject(( new Error(
|
|
627
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', { key: 'error.invalidformat.tokenColors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] }, "Problem parsing color theme file: {0}. Property 'tokenColors' should be either an array specifying colors or a path to a TextMate theme file", ( themeLocation.toString()))
|
|
628
|
+
)));
|
|
636
629
|
}
|
|
637
630
|
}
|
|
638
631
|
const semanticTokenColors = contentValue.semanticTokenColors;
|
|
@@ -645,11 +638,9 @@ async function _loadColorTheme(extensionResourceLoaderService, themeLocation, re
|
|
|
645
638
|
}
|
|
646
639
|
}
|
|
647
640
|
catch (e) {
|
|
648
|
-
return Promise.reject(( new Error(
|
|
649
|
-
{ key: 'error.invalidformat.semanticTokenColors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] },
|
|
650
|
-
|
|
651
|
-
( themeLocation.toString())
|
|
652
|
-
)))));
|
|
641
|
+
return Promise.reject(( new Error(
|
|
642
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', { key: 'error.invalidformat.semanticTokenColors', comment: ['{0} will be replaced by a path. Values in quotes should not be translated.'] }, "Problem parsing color theme file: {0}. Property 'semanticTokenColors' contains a invalid selector", ( themeLocation.toString()))
|
|
643
|
+
)));
|
|
653
644
|
}
|
|
654
645
|
}
|
|
655
646
|
}
|
|
@@ -664,24 +655,22 @@ function _loadSyntaxTokens(extensionResourceLoaderService, themeLocation, result
|
|
|
664
655
|
const contentValue = parse(content);
|
|
665
656
|
const settings = contentValue.settings;
|
|
666
657
|
if (!Array.isArray(settings)) {
|
|
667
|
-
return Promise.reject(( new Error(
|
|
668
|
-
'error.plist.invalidformat',
|
|
669
|
-
|
|
670
|
-
)))));
|
|
658
|
+
return Promise.reject(( new Error(
|
|
659
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', 'error.plist.invalidformat', "Problem parsing tmTheme file: {0}. 'settings' is not array.")
|
|
660
|
+
)));
|
|
671
661
|
}
|
|
672
662
|
convertSettings(settings, result);
|
|
673
663
|
return Promise.resolve(null);
|
|
674
664
|
}
|
|
675
665
|
catch (e) {
|
|
676
|
-
return Promise.reject(( new Error(
|
|
666
|
+
return Promise.reject(( new Error(
|
|
667
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', 'error.cannotparse', "Problems parsing tmTheme file: {0}", e.message)
|
|
668
|
+
)));
|
|
677
669
|
}
|
|
678
670
|
}, error => {
|
|
679
|
-
return Promise.reject(( new Error(
|
|
680
|
-
'error.cannotload',
|
|
681
|
-
|
|
682
|
-
( themeLocation.toString()),
|
|
683
|
-
error.message
|
|
684
|
-
)))));
|
|
671
|
+
return Promise.reject(( new Error(
|
|
672
|
+
nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeData', 'error.cannotload', "Problems loading tmTheme file {0}: {1}", ( themeLocation.toString()), error.message)
|
|
673
|
+
)));
|
|
685
674
|
});
|
|
686
675
|
}
|
|
687
676
|
const defaultThemeColors = {
|
|
@@ -125,34 +125,25 @@ const textmateColorSchema = {
|
|
|
125
125
|
},
|
|
126
126
|
settings: {
|
|
127
127
|
type: 'object',
|
|
128
|
-
description:
|
|
128
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.token.settings', 'Colors and styles for the token.'),
|
|
129
129
|
properties: {
|
|
130
130
|
foreground: {
|
|
131
131
|
type: 'string',
|
|
132
|
-
description:
|
|
132
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.token.foreground', 'Foreground color for the token.'),
|
|
133
133
|
format: 'color-hex',
|
|
134
134
|
default: '#ff0000'
|
|
135
135
|
},
|
|
136
136
|
background: {
|
|
137
137
|
type: 'string',
|
|
138
|
-
deprecationMessage: (
|
|
139
|
-
'schema.token.background.warning',
|
|
140
|
-
'Token background colors are currently not supported.'
|
|
141
|
-
))
|
|
138
|
+
deprecationMessage: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.token.background.warning', 'Token background colors are currently not supported.')
|
|
142
139
|
},
|
|
143
140
|
fontStyle: {
|
|
144
141
|
type: 'string',
|
|
145
|
-
description: (
|
|
146
|
-
'schema.token.fontStyle',
|
|
147
|
-
'Font style of the rule: \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination. The empty string unsets inherited settings.'
|
|
148
|
-
)),
|
|
142
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.token.fontStyle', 'Font style of the rule: \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination. The empty string unsets inherited settings.'),
|
|
149
143
|
pattern: '^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$',
|
|
150
|
-
patternErrorMessage: (
|
|
151
|
-
'schema.fontStyle.error',
|
|
152
|
-
'Font style must be \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination or the empty string.'
|
|
153
|
-
)),
|
|
144
|
+
patternErrorMessage: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.fontStyle.error', 'Font style must be \'italic\', \'bold\', \'underline\', \'strikethrough\' or a combination or the empty string.'),
|
|
154
145
|
defaultSnippets: [
|
|
155
|
-
{ label:
|
|
146
|
+
{ label: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.token.fontStyle.none', 'None (clear inherited style)'), bodyText: '""' },
|
|
156
147
|
{ body: 'italic' },
|
|
157
148
|
{ body: 'bold' },
|
|
158
149
|
{ body: 'underline' },
|
|
@@ -181,13 +172,10 @@ const textmateColorSchema = {
|
|
|
181
172
|
properties: {
|
|
182
173
|
name: {
|
|
183
174
|
type: 'string',
|
|
184
|
-
description:
|
|
175
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.properties.name', 'Description of the rule.')
|
|
185
176
|
},
|
|
186
177
|
scope: {
|
|
187
|
-
description: (
|
|
188
|
-
'schema.properties.scope',
|
|
189
|
-
'Scope selector against which this rule matches.'
|
|
190
|
-
)),
|
|
178
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.properties.scope', 'Scope selector against which this rule matches.'),
|
|
191
179
|
anyOf: [
|
|
192
180
|
{
|
|
193
181
|
enum: textMateScopes
|
|
@@ -226,34 +214,28 @@ const colorThemeSchema = {
|
|
|
226
214
|
allowTrailingCommas: true,
|
|
227
215
|
properties: {
|
|
228
216
|
colors: {
|
|
229
|
-
description:
|
|
217
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.workbenchColors', 'Colors in the workbench'),
|
|
230
218
|
$ref: workbenchColorsSchemaId,
|
|
231
219
|
additionalProperties: false
|
|
232
220
|
},
|
|
233
221
|
tokenColors: {
|
|
234
222
|
anyOf: [{
|
|
235
223
|
type: 'string',
|
|
236
|
-
description: (
|
|
237
|
-
'schema.tokenColors.path',
|
|
238
|
-
'Path to a tmTheme file (relative to the current file).'
|
|
239
|
-
))
|
|
224
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.tokenColors.path', 'Path to a tmTheme file (relative to the current file).')
|
|
240
225
|
},
|
|
241
226
|
{
|
|
242
|
-
description:
|
|
227
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.colors', 'Colors for syntax highlighting'),
|
|
243
228
|
$ref: textmateColorsSchemaId
|
|
244
229
|
}
|
|
245
230
|
]
|
|
246
231
|
},
|
|
247
232
|
semanticHighlighting: {
|
|
248
233
|
type: 'boolean',
|
|
249
|
-
description: (
|
|
250
|
-
'schema.supportsSemanticHighlighting',
|
|
251
|
-
'Whether semantic highlighting should be enabled for this theme.'
|
|
252
|
-
))
|
|
234
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.supportsSemanticHighlighting', 'Whether semantic highlighting should be enabled for this theme.')
|
|
253
235
|
},
|
|
254
236
|
semanticTokenColors: {
|
|
255
237
|
type: 'object',
|
|
256
|
-
description:
|
|
238
|
+
description: nls.localizeWithPath('vs/workbench/services/themes/common/colorThemeSchema', 'schema.semanticTokenColors', 'Colors for semantic tokens'),
|
|
257
239
|
$ref: tokenStylingSchemaId
|
|
258
240
|
}
|
|
259
241
|
}
|