@codingame/monaco-vscode-theme-service-override 3.2.3 → 4.1.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 +3 -3
- package/theme.js +2 -2
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/workbench/contrib/themes/browser/themes.contribution.js +0 -947
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +0 -374
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +0 -307
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +0 -757
- package/vscode/src/vs/workbench/services/themes/common/colorThemeData.js +0 -878
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +0 -301
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +0 -434
- package/vscode/src/vs/workbench/services/themes/common/plistParser.js +0 -440
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +0 -116
- package/vscode/src/vs/workbench/services/themes/common/textMateScopeMatcher.js +0 -121
- package/vscode/src/vs/workbench/services/themes/common/themeCompatibility.js +0 -68
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +0 -461
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +0 -339
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
function parse(content) {
|
|
2
|
-
return _parse(content, null, null);
|
|
3
|
-
}
|
|
4
|
-
function _parse(content, filename, locationKeyName) {
|
|
5
|
-
const len = content.length;
|
|
6
|
-
let pos = 0;
|
|
7
|
-
let line = 1;
|
|
8
|
-
let char = 0;
|
|
9
|
-
if (len > 0 && content.charCodeAt(0) === 65279 ) {
|
|
10
|
-
pos = 1;
|
|
11
|
-
}
|
|
12
|
-
function advancePosBy(by) {
|
|
13
|
-
if (locationKeyName === null) {
|
|
14
|
-
pos = pos + by;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
while (by > 0) {
|
|
18
|
-
const chCode = content.charCodeAt(pos);
|
|
19
|
-
if (chCode === 10 ) {
|
|
20
|
-
pos++;
|
|
21
|
-
line++;
|
|
22
|
-
char = 0;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
pos++;
|
|
26
|
-
char++;
|
|
27
|
-
}
|
|
28
|
-
by--;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function advancePosTo(to) {
|
|
33
|
-
if (locationKeyName === null) {
|
|
34
|
-
pos = to;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
advancePosBy(to - pos);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function skipWhitespace() {
|
|
41
|
-
while (pos < len) {
|
|
42
|
-
const chCode = content.charCodeAt(pos);
|
|
43
|
-
if (chCode !== 32 && chCode !== 9 && chCode !== 13 && chCode !== 10 ) {
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
advancePosBy(1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function advanceIfStartsWith(str) {
|
|
50
|
-
if (content.substr(pos, str.length) === str) {
|
|
51
|
-
advancePosBy(str.length);
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
function advanceUntil(str) {
|
|
57
|
-
const nextOccurence = content.indexOf(str, pos);
|
|
58
|
-
if (nextOccurence !== -1) {
|
|
59
|
-
advancePosTo(nextOccurence + str.length);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
advancePosTo(len);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function captureUntil(str) {
|
|
66
|
-
const nextOccurence = content.indexOf(str, pos);
|
|
67
|
-
if (nextOccurence !== -1) {
|
|
68
|
-
const r = content.substring(pos, nextOccurence);
|
|
69
|
-
advancePosTo(nextOccurence + str.length);
|
|
70
|
-
return r;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
const r = content.substr(pos);
|
|
74
|
-
advancePosTo(len);
|
|
75
|
-
return r;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
let state = 0 ;
|
|
79
|
-
let cur = null;
|
|
80
|
-
const stateStack = [];
|
|
81
|
-
const objStack = [];
|
|
82
|
-
let curKey = null;
|
|
83
|
-
function pushState(newState, newCur) {
|
|
84
|
-
stateStack.push(state);
|
|
85
|
-
objStack.push(cur);
|
|
86
|
-
state = newState;
|
|
87
|
-
cur = newCur;
|
|
88
|
-
}
|
|
89
|
-
function popState() {
|
|
90
|
-
if (stateStack.length === 0) {
|
|
91
|
-
return fail('illegal state stack');
|
|
92
|
-
}
|
|
93
|
-
state = stateStack.pop();
|
|
94
|
-
cur = objStack.pop();
|
|
95
|
-
}
|
|
96
|
-
function fail(msg) {
|
|
97
|
-
throw new Error('Near offset ' + pos + ': ' + msg + ' ~~~' + content.substr(pos, 50) + '~~~');
|
|
98
|
-
}
|
|
99
|
-
const dictState = {
|
|
100
|
-
enterDict: function () {
|
|
101
|
-
if (curKey === null) {
|
|
102
|
-
return fail('missing <key>');
|
|
103
|
-
}
|
|
104
|
-
const newDict = {};
|
|
105
|
-
if (locationKeyName !== null) {
|
|
106
|
-
newDict[locationKeyName] = {
|
|
107
|
-
filename: filename,
|
|
108
|
-
line: line,
|
|
109
|
-
char: char
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
cur[curKey] = newDict;
|
|
113
|
-
curKey = null;
|
|
114
|
-
pushState(1 , newDict);
|
|
115
|
-
},
|
|
116
|
-
enterArray: function () {
|
|
117
|
-
if (curKey === null) {
|
|
118
|
-
return fail('missing <key>');
|
|
119
|
-
}
|
|
120
|
-
const newArr = [];
|
|
121
|
-
cur[curKey] = newArr;
|
|
122
|
-
curKey = null;
|
|
123
|
-
pushState(2 , newArr);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const arrState = {
|
|
127
|
-
enterDict: function () {
|
|
128
|
-
const newDict = {};
|
|
129
|
-
if (locationKeyName !== null) {
|
|
130
|
-
newDict[locationKeyName] = {
|
|
131
|
-
filename: filename,
|
|
132
|
-
line: line,
|
|
133
|
-
char: char
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
cur.push(newDict);
|
|
137
|
-
pushState(1 , newDict);
|
|
138
|
-
},
|
|
139
|
-
enterArray: function () {
|
|
140
|
-
const newArr = [];
|
|
141
|
-
cur.push(newArr);
|
|
142
|
-
pushState(2 , newArr);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
function enterDict() {
|
|
146
|
-
if (state === 1 ) {
|
|
147
|
-
dictState.enterDict();
|
|
148
|
-
}
|
|
149
|
-
else if (state === 2 ) {
|
|
150
|
-
arrState.enterDict();
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
cur = {};
|
|
154
|
-
if (locationKeyName !== null) {
|
|
155
|
-
cur[locationKeyName] = {
|
|
156
|
-
filename: filename,
|
|
157
|
-
line: line,
|
|
158
|
-
char: char
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
pushState(1 , cur);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function leaveDict() {
|
|
165
|
-
if (state === 1 ) {
|
|
166
|
-
popState();
|
|
167
|
-
}
|
|
168
|
-
else if (state === 2 ) {
|
|
169
|
-
return fail('unexpected </dict>');
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
return fail('unexpected </dict>');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function enterArray() {
|
|
176
|
-
if (state === 1 ) {
|
|
177
|
-
dictState.enterArray();
|
|
178
|
-
}
|
|
179
|
-
else if (state === 2 ) {
|
|
180
|
-
arrState.enterArray();
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
cur = [];
|
|
184
|
-
pushState(2 , cur);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function leaveArray() {
|
|
188
|
-
if (state === 1 ) {
|
|
189
|
-
return fail('unexpected </array>');
|
|
190
|
-
}
|
|
191
|
-
else if (state === 2 ) {
|
|
192
|
-
popState();
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
return fail('unexpected </array>');
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function acceptKey(val) {
|
|
199
|
-
if (state === 1 ) {
|
|
200
|
-
if (curKey !== null) {
|
|
201
|
-
return fail('too many <key>');
|
|
202
|
-
}
|
|
203
|
-
curKey = val;
|
|
204
|
-
}
|
|
205
|
-
else if (state === 2 ) {
|
|
206
|
-
return fail('unexpected <key>');
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
return fail('unexpected <key>');
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
function acceptString(val) {
|
|
213
|
-
if (state === 1 ) {
|
|
214
|
-
if (curKey === null) {
|
|
215
|
-
return fail('missing <key>');
|
|
216
|
-
}
|
|
217
|
-
cur[curKey] = val;
|
|
218
|
-
curKey = null;
|
|
219
|
-
}
|
|
220
|
-
else if (state === 2 ) {
|
|
221
|
-
cur.push(val);
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
cur = val;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function acceptReal(val) {
|
|
228
|
-
if (isNaN(val)) {
|
|
229
|
-
return fail('cannot parse float');
|
|
230
|
-
}
|
|
231
|
-
if (state === 1 ) {
|
|
232
|
-
if (curKey === null) {
|
|
233
|
-
return fail('missing <key>');
|
|
234
|
-
}
|
|
235
|
-
cur[curKey] = val;
|
|
236
|
-
curKey = null;
|
|
237
|
-
}
|
|
238
|
-
else if (state === 2 ) {
|
|
239
|
-
cur.push(val);
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
cur = val;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
function acceptInteger(val) {
|
|
246
|
-
if (isNaN(val)) {
|
|
247
|
-
return fail('cannot parse integer');
|
|
248
|
-
}
|
|
249
|
-
if (state === 1 ) {
|
|
250
|
-
if (curKey === null) {
|
|
251
|
-
return fail('missing <key>');
|
|
252
|
-
}
|
|
253
|
-
cur[curKey] = val;
|
|
254
|
-
curKey = null;
|
|
255
|
-
}
|
|
256
|
-
else if (state === 2 ) {
|
|
257
|
-
cur.push(val);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
cur = val;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
function acceptDate(val) {
|
|
264
|
-
if (state === 1 ) {
|
|
265
|
-
if (curKey === null) {
|
|
266
|
-
return fail('missing <key>');
|
|
267
|
-
}
|
|
268
|
-
cur[curKey] = val;
|
|
269
|
-
curKey = null;
|
|
270
|
-
}
|
|
271
|
-
else if (state === 2 ) {
|
|
272
|
-
cur.push(val);
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
cur = val;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function acceptData(val) {
|
|
279
|
-
if (state === 1 ) {
|
|
280
|
-
if (curKey === null) {
|
|
281
|
-
return fail('missing <key>');
|
|
282
|
-
}
|
|
283
|
-
cur[curKey] = val;
|
|
284
|
-
curKey = null;
|
|
285
|
-
}
|
|
286
|
-
else if (state === 2 ) {
|
|
287
|
-
cur.push(val);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
cur = val;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function acceptBool(val) {
|
|
294
|
-
if (state === 1 ) {
|
|
295
|
-
if (curKey === null) {
|
|
296
|
-
return fail('missing <key>');
|
|
297
|
-
}
|
|
298
|
-
cur[curKey] = val;
|
|
299
|
-
curKey = null;
|
|
300
|
-
}
|
|
301
|
-
else if (state === 2 ) {
|
|
302
|
-
cur.push(val);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
cur = val;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function escapeVal(str) {
|
|
309
|
-
return str.replace(/&#([0-9]+);/g, function (_, m0) {
|
|
310
|
-
return String.fromCodePoint(parseInt(m0, 10));
|
|
311
|
-
}).replace(/&#x([0-9a-f]+);/g, function (_, m0) {
|
|
312
|
-
return String.fromCodePoint(parseInt(m0, 16));
|
|
313
|
-
}).replace(/&|<|>|"|'/g, function (_) {
|
|
314
|
-
switch (_) {
|
|
315
|
-
case '&': return '&';
|
|
316
|
-
case '<': return '<';
|
|
317
|
-
case '>': return '>';
|
|
318
|
-
case '"': return '"';
|
|
319
|
-
case ''': return '\'';
|
|
320
|
-
}
|
|
321
|
-
return _;
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
function parseOpenTag() {
|
|
325
|
-
let r = captureUntil('>');
|
|
326
|
-
let isClosed = false;
|
|
327
|
-
if (r.charCodeAt(r.length - 1) === 47 ) {
|
|
328
|
-
isClosed = true;
|
|
329
|
-
r = r.substring(0, r.length - 1);
|
|
330
|
-
}
|
|
331
|
-
return {
|
|
332
|
-
name: r.trim(),
|
|
333
|
-
isClosed: isClosed
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function parseTagValue(tag) {
|
|
337
|
-
if (tag.isClosed) {
|
|
338
|
-
return '';
|
|
339
|
-
}
|
|
340
|
-
const val = captureUntil('</');
|
|
341
|
-
advanceUntil('>');
|
|
342
|
-
return escapeVal(val);
|
|
343
|
-
}
|
|
344
|
-
while (pos < len) {
|
|
345
|
-
skipWhitespace();
|
|
346
|
-
if (pos >= len) {
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
const chCode = content.charCodeAt(pos);
|
|
350
|
-
advancePosBy(1);
|
|
351
|
-
if (chCode !== 60 ) {
|
|
352
|
-
return fail('expected <');
|
|
353
|
-
}
|
|
354
|
-
if (pos >= len) {
|
|
355
|
-
return fail('unexpected end of input');
|
|
356
|
-
}
|
|
357
|
-
const peekChCode = content.charCodeAt(pos);
|
|
358
|
-
if (peekChCode === 63 ) {
|
|
359
|
-
advancePosBy(1);
|
|
360
|
-
advanceUntil('?>');
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
if (peekChCode === 33 ) {
|
|
364
|
-
advancePosBy(1);
|
|
365
|
-
if (advanceIfStartsWith('--')) {
|
|
366
|
-
advanceUntil('-->');
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
advanceUntil('>');
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
if (peekChCode === 47 ) {
|
|
373
|
-
advancePosBy(1);
|
|
374
|
-
skipWhitespace();
|
|
375
|
-
if (advanceIfStartsWith('plist')) {
|
|
376
|
-
advanceUntil('>');
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
if (advanceIfStartsWith('dict')) {
|
|
380
|
-
advanceUntil('>');
|
|
381
|
-
leaveDict();
|
|
382
|
-
continue;
|
|
383
|
-
}
|
|
384
|
-
if (advanceIfStartsWith('array')) {
|
|
385
|
-
advanceUntil('>');
|
|
386
|
-
leaveArray();
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
|
-
return fail('unexpected closed tag');
|
|
390
|
-
}
|
|
391
|
-
const tag = parseOpenTag();
|
|
392
|
-
switch (tag.name) {
|
|
393
|
-
case 'dict':
|
|
394
|
-
enterDict();
|
|
395
|
-
if (tag.isClosed) {
|
|
396
|
-
leaveDict();
|
|
397
|
-
}
|
|
398
|
-
continue;
|
|
399
|
-
case 'array':
|
|
400
|
-
enterArray();
|
|
401
|
-
if (tag.isClosed) {
|
|
402
|
-
leaveArray();
|
|
403
|
-
}
|
|
404
|
-
continue;
|
|
405
|
-
case 'key':
|
|
406
|
-
acceptKey(parseTagValue(tag));
|
|
407
|
-
continue;
|
|
408
|
-
case 'string':
|
|
409
|
-
acceptString(parseTagValue(tag));
|
|
410
|
-
continue;
|
|
411
|
-
case 'real':
|
|
412
|
-
acceptReal(parseFloat(parseTagValue(tag)));
|
|
413
|
-
continue;
|
|
414
|
-
case 'integer':
|
|
415
|
-
acceptInteger(parseInt(parseTagValue(tag), 10));
|
|
416
|
-
continue;
|
|
417
|
-
case 'date':
|
|
418
|
-
acceptDate(( new Date(parseTagValue(tag))));
|
|
419
|
-
continue;
|
|
420
|
-
case 'data':
|
|
421
|
-
acceptData(parseTagValue(tag));
|
|
422
|
-
continue;
|
|
423
|
-
case 'true':
|
|
424
|
-
parseTagValue(tag);
|
|
425
|
-
acceptBool(true);
|
|
426
|
-
continue;
|
|
427
|
-
case 'false':
|
|
428
|
-
parseTagValue(tag);
|
|
429
|
-
acceptBool(false);
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
if (/^plist/.test(tag.name)) {
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
return fail('unexpected opened tag ' + tag.name);
|
|
436
|
-
}
|
|
437
|
-
return cur;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export { parse };
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
-
import { Extensions } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
4
|
-
import { iconsSchemaId } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
5
|
-
|
|
6
|
-
const fontIdRegex = '^([\\w_-]+)$';
|
|
7
|
-
const fontStyleRegex = '^(normal|italic|(oblique[ \\w\\s-]+))$';
|
|
8
|
-
const fontWeightRegex = '^(normal|bold|lighter|bolder|(\\d{0-1000}))$';
|
|
9
|
-
const fontSizeRegex = '^([\\w .%_-]+)$';
|
|
10
|
-
const fontFormatRegex = '^woff|woff2|truetype|opentype|embedded-opentype|svg$';
|
|
11
|
-
const schemaId = 'vscode://schemas/product-icon-theme';
|
|
12
|
-
const schema = {
|
|
13
|
-
type: 'object',
|
|
14
|
-
allowComments: true,
|
|
15
|
-
allowTrailingCommas: true,
|
|
16
|
-
properties: {
|
|
17
|
-
fonts: {
|
|
18
|
-
type: 'array',
|
|
19
|
-
items: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
id: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: ( localizeWithPath(
|
|
25
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
26
|
-
'schema.id',
|
|
27
|
-
'The ID of the font.'
|
|
28
|
-
)),
|
|
29
|
-
pattern: fontIdRegex,
|
|
30
|
-
patternErrorMessage: ( localizeWithPath(
|
|
31
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
32
|
-
'schema.id.formatError',
|
|
33
|
-
'The ID must only contain letters, numbers, underscore and minus.'
|
|
34
|
-
))
|
|
35
|
-
},
|
|
36
|
-
src: {
|
|
37
|
-
type: 'array',
|
|
38
|
-
description: ( localizeWithPath(
|
|
39
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
40
|
-
'schema.src',
|
|
41
|
-
'The location of the font.'
|
|
42
|
-
)),
|
|
43
|
-
items: {
|
|
44
|
-
type: 'object',
|
|
45
|
-
properties: {
|
|
46
|
-
path: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: ( localizeWithPath(
|
|
49
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
50
|
-
'schema.font-path',
|
|
51
|
-
'The font path, relative to the current product icon theme file.'
|
|
52
|
-
)),
|
|
53
|
-
},
|
|
54
|
-
format: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
description: ( localizeWithPath(
|
|
57
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
58
|
-
'schema.font-format',
|
|
59
|
-
'The format of the font.'
|
|
60
|
-
)),
|
|
61
|
-
enum: ['woff', 'woff2', 'truetype', 'opentype', 'embedded-opentype', 'svg']
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
required: [
|
|
65
|
-
'path',
|
|
66
|
-
'format'
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
weight: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
description: ( localizeWithPath(
|
|
73
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
74
|
-
'schema.font-weight',
|
|
75
|
-
'The weight of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight for valid values.'
|
|
76
|
-
)),
|
|
77
|
-
anyOf: [
|
|
78
|
-
{ enum: ['normal', 'bold', 'lighter', 'bolder'] },
|
|
79
|
-
{ type: 'string', pattern: fontWeightRegex }
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
style: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: ( localizeWithPath(
|
|
85
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
86
|
-
'schema.font-style',
|
|
87
|
-
'The style of the font. See https://developer.mozilla.org/en-US/docs/Web/CSS/font-style for valid values.'
|
|
88
|
-
)),
|
|
89
|
-
anyOf: [
|
|
90
|
-
{ enum: ['normal', 'italic', 'oblique'] },
|
|
91
|
-
{ type: 'string', pattern: fontStyleRegex }
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
required: [
|
|
96
|
-
'id',
|
|
97
|
-
'src'
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
iconDefinitions: {
|
|
102
|
-
description: ( localizeWithPath(
|
|
103
|
-
'vs/workbench/services/themes/common/productIconThemeSchema',
|
|
104
|
-
'schema.iconDefinitions',
|
|
105
|
-
'Association of icon name to a font character.'
|
|
106
|
-
)),
|
|
107
|
-
$ref: iconsSchemaId
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
function registerProductIconThemeSchemas() {
|
|
112
|
-
const schemaRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
113
|
-
schemaRegistry.registerSchema(schemaId, schema);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export { fontFormatRegex, fontIdRegex, fontSizeRegex, fontStyleRegex, fontWeightRegex, registerProductIconThemeSchemas };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
function createMatchers(selector, matchesName, results) {
|
|
2
|
-
const tokenizer = newTokenizer(selector);
|
|
3
|
-
let token = tokenizer.next();
|
|
4
|
-
while (token !== null) {
|
|
5
|
-
let priority = 0;
|
|
6
|
-
if (token.length === 2 && token.charAt(1) === ':') {
|
|
7
|
-
switch (token.charAt(0)) {
|
|
8
|
-
case 'R':
|
|
9
|
-
priority = 1;
|
|
10
|
-
break;
|
|
11
|
-
case 'L':
|
|
12
|
-
priority = -1;
|
|
13
|
-
break;
|
|
14
|
-
default:
|
|
15
|
-
console.log(`Unknown priority ${token} in scope selector`);
|
|
16
|
-
}
|
|
17
|
-
token = tokenizer.next();
|
|
18
|
-
}
|
|
19
|
-
const matcher = parseConjunction();
|
|
20
|
-
if (matcher) {
|
|
21
|
-
results.push({ matcher, priority });
|
|
22
|
-
}
|
|
23
|
-
if (token !== ',') {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
token = tokenizer.next();
|
|
27
|
-
}
|
|
28
|
-
function parseOperand() {
|
|
29
|
-
if (token === '-') {
|
|
30
|
-
token = tokenizer.next();
|
|
31
|
-
const expressionToNegate = parseOperand();
|
|
32
|
-
if (!expressionToNegate) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return matcherInput => {
|
|
36
|
-
const score = expressionToNegate(matcherInput);
|
|
37
|
-
return score < 0 ? 0 : -1;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
if (token === '(') {
|
|
41
|
-
token = tokenizer.next();
|
|
42
|
-
const expressionInParents = parseInnerExpression();
|
|
43
|
-
if (token === ')') {
|
|
44
|
-
token = tokenizer.next();
|
|
45
|
-
}
|
|
46
|
-
return expressionInParents;
|
|
47
|
-
}
|
|
48
|
-
if (isIdentifier(token)) {
|
|
49
|
-
const identifiers = [];
|
|
50
|
-
do {
|
|
51
|
-
identifiers.push(token);
|
|
52
|
-
token = tokenizer.next();
|
|
53
|
-
} while (isIdentifier(token));
|
|
54
|
-
return matcherInput => matchesName(identifiers, matcherInput);
|
|
55
|
-
}
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
function parseConjunction() {
|
|
59
|
-
let matcher = parseOperand();
|
|
60
|
-
if (!matcher) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
const matchers = [];
|
|
64
|
-
while (matcher) {
|
|
65
|
-
matchers.push(matcher);
|
|
66
|
-
matcher = parseOperand();
|
|
67
|
-
}
|
|
68
|
-
return matcherInput => {
|
|
69
|
-
let min = matchers[0](matcherInput);
|
|
70
|
-
for (let i = 1; min >= 0 && i < matchers.length; i++) {
|
|
71
|
-
min = Math.min(min, matchers[i](matcherInput));
|
|
72
|
-
}
|
|
73
|
-
return min;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function parseInnerExpression() {
|
|
77
|
-
let matcher = parseConjunction();
|
|
78
|
-
if (!matcher) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
const matchers = [];
|
|
82
|
-
while (matcher) {
|
|
83
|
-
matchers.push(matcher);
|
|
84
|
-
if (token === '|' || token === ',') {
|
|
85
|
-
do {
|
|
86
|
-
token = tokenizer.next();
|
|
87
|
-
} while (token === '|' || token === ',');
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
matcher = parseConjunction();
|
|
93
|
-
}
|
|
94
|
-
return matcherInput => {
|
|
95
|
-
let max = matchers[0](matcherInput);
|
|
96
|
-
for (let i = 1; i < matchers.length; i++) {
|
|
97
|
-
max = Math.max(max, matchers[i](matcherInput));
|
|
98
|
-
}
|
|
99
|
-
return max;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function isIdentifier(token) {
|
|
104
|
-
return !!token && !!token.match(/[\w\.:]+/);
|
|
105
|
-
}
|
|
106
|
-
function newTokenizer(input) {
|
|
107
|
-
const regex = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g;
|
|
108
|
-
let match = regex.exec(input);
|
|
109
|
-
return {
|
|
110
|
-
next: () => {
|
|
111
|
-
if (!match) {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
const res = match[0];
|
|
115
|
-
match = regex.exec(input);
|
|
116
|
-
return res;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export { createMatchers };
|