@codingame/monaco-vscode-api 1.68.6 → 1.69.1
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/README.md +102 -7
- package/dist/api.js +481 -9576
- package/dist/configuration.d.ts +488 -0
- package/dist/configuration.js +582 -0
- package/dist/extHost.js +14881 -0
- package/dist/files.js +1325 -0
- package/dist/injection.js +15 -0
- package/dist/jsonErrorMessages.js +17 -0
- package/dist/keybindings.d.ts +502 -0
- package/dist/keybindings.js +2352 -0
- package/dist/languageConfiguration.d.ts +8 -0
- package/dist/languageConfiguration.js +925 -0
- package/dist/languageService.js +340 -0
- package/dist/languages.d.ts +477 -0
- package/dist/languages.js +21 -0
- package/dist/layoutService.js +4 -0
- package/dist/messages.d.ts +7 -0
- package/dist/messages.js +3624 -0
- package/dist/missing-services.js +7293 -0
- package/dist/modelEditor.d.ts +164 -0
- package/dist/modelEditor.js +739 -0
- package/dist/monaco.d.ts +4914 -0
- package/dist/monaco.js +261 -0
- package/dist/services.d.ts +14806 -2098
- package/dist/services.js +22 -25
- package/dist/services2.js +423 -0
- package/dist/snippets.d.ts +466 -0
- package/dist/snippets.js +864 -0
- package/dist/textmate.d.ts +683 -0
- package/dist/textmate.js +739 -0
- package/dist/theme.d.ts +23 -0
- package/dist/theme.js +4167 -0
- package/dist/tokenClassification.d.ts +479 -0
- package/dist/tokenClassification.js +302 -0
- package/dist/tokenClassificationRegistry.js +472 -0
- package/dist/tools.js +31 -0
- package/dist/tslib.es6.js +21 -0
- package/dist/workbenchThemeService.js +46 -0
- package/dist/workspaceContext.js +49 -0
- package/package.json +106 -37
- package/dist/api.amd.js +0 -10066
- package/dist/api.cjs +0 -10107
- package/dist/services.amd.js +0 -33
- package/dist/services.cjs +0 -33
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { E as Emitter } from './missing-services.js';
|
|
2
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
4
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
5
|
+
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
6
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
7
|
+
const TOKEN_TYPE_WILDCARD = '*';
|
|
8
|
+
const TOKEN_CLASSIFIER_LANGUAGE_SEPARATOR = ':';
|
|
9
|
+
const CLASSIFIER_MODIFIER_SEPARATOR = '.';
|
|
10
|
+
const idPattern = '\\w+[-_\\w+]*';
|
|
11
|
+
const typeAndModifierIdPattern = `^${idPattern}$`;
|
|
12
|
+
const selectorPattern = `^(${idPattern}|\\*)(\\${CLASSIFIER_MODIFIER_SEPARATOR}${idPattern})*(${TOKEN_CLASSIFIER_LANGUAGE_SEPARATOR}${idPattern})?$`;
|
|
13
|
+
const fontStylePattern = '^(\\s*(italic|bold|underline|strikethrough))*\\s*$';
|
|
14
|
+
class TokenStyle {
|
|
15
|
+
constructor(foreground, bold, underline, strikethrough, italic) {
|
|
16
|
+
this.foreground = foreground;
|
|
17
|
+
this.bold = bold;
|
|
18
|
+
this.underline = underline;
|
|
19
|
+
this.strikethrough = strikethrough;
|
|
20
|
+
this.italic = italic;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
( ((function(TokenStyle) {
|
|
24
|
+
function toJSONObject(style) {
|
|
25
|
+
return {
|
|
26
|
+
_foreground: style.foreground === undefined ? null : Color.Format.CSS.formatHexA(style.foreground, true),
|
|
27
|
+
_bold: style.bold === undefined ? null : style.bold,
|
|
28
|
+
_underline: style.underline === undefined ? null : style.underline,
|
|
29
|
+
_italic: style.italic === undefined ? null : style.italic,
|
|
30
|
+
_strikethrough: style.strikethrough === undefined ? null : style.strikethrough,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
TokenStyle.toJSONObject = toJSONObject;
|
|
34
|
+
function fromJSONObject(obj) {
|
|
35
|
+
if (obj) {
|
|
36
|
+
const boolOrUndef = (b) => (typeof b === 'boolean') ? b : undefined;
|
|
37
|
+
const colorOrUndef = (s) => (typeof s === 'string') ? ( (Color.fromHex(s))) : undefined;
|
|
38
|
+
return (
|
|
39
|
+
(new TokenStyle(
|
|
40
|
+
colorOrUndef(obj._foreground),
|
|
41
|
+
boolOrUndef(obj._bold),
|
|
42
|
+
boolOrUndef(obj._underline),
|
|
43
|
+
boolOrUndef(obj._strikethrough),
|
|
44
|
+
boolOrUndef(obj._italic)
|
|
45
|
+
))
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
TokenStyle.fromJSONObject = fromJSONObject;
|
|
51
|
+
function equals(s1, s2) {
|
|
52
|
+
if (s1 === s2) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return s1 !== undefined && s2 !== undefined
|
|
56
|
+
&& (s1.foreground instanceof Color ? s1.foreground.equals(s2.foreground) : s2.foreground === undefined)
|
|
57
|
+
&& s1.bold === s2.bold
|
|
58
|
+
&& s1.underline === s2.underline
|
|
59
|
+
&& s1.strikethrough === s2.strikethrough
|
|
60
|
+
&& s1.italic === s2.italic;
|
|
61
|
+
}
|
|
62
|
+
TokenStyle.equals = equals;
|
|
63
|
+
function is(s) {
|
|
64
|
+
return s instanceof TokenStyle;
|
|
65
|
+
}
|
|
66
|
+
TokenStyle.is = is;
|
|
67
|
+
function fromData(data) {
|
|
68
|
+
return (
|
|
69
|
+
(new TokenStyle(
|
|
70
|
+
data.foreground,
|
|
71
|
+
data.bold,
|
|
72
|
+
data.underline,
|
|
73
|
+
data.strikethrough,
|
|
74
|
+
data.italic
|
|
75
|
+
))
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
TokenStyle.fromData = fromData;
|
|
79
|
+
function fromSettings(foreground, fontStyle, bold, underline, strikethrough, italic) {
|
|
80
|
+
let foregroundColor = undefined;
|
|
81
|
+
if (foreground !== undefined) {
|
|
82
|
+
foregroundColor = ( (Color.fromHex(foreground)));
|
|
83
|
+
}
|
|
84
|
+
if (fontStyle !== undefined) {
|
|
85
|
+
bold = italic = underline = strikethrough = false;
|
|
86
|
+
const expression = /italic|bold|underline|strikethrough/g;
|
|
87
|
+
let match;
|
|
88
|
+
while ((match = expression.exec(fontStyle))) {
|
|
89
|
+
switch (match[0]) {
|
|
90
|
+
case 'bold':
|
|
91
|
+
bold = true;
|
|
92
|
+
break;
|
|
93
|
+
case 'italic':
|
|
94
|
+
italic = true;
|
|
95
|
+
break;
|
|
96
|
+
case 'underline':
|
|
97
|
+
underline = true;
|
|
98
|
+
break;
|
|
99
|
+
case 'strikethrough':
|
|
100
|
+
strikethrough = true;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return (
|
|
106
|
+
(new TokenStyle(foregroundColor, bold, underline, strikethrough, italic))
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
TokenStyle.fromSettings = fromSettings;
|
|
110
|
+
})(TokenStyle || (TokenStyle = {}))));
|
|
111
|
+
var SemanticTokenRule;
|
|
112
|
+
( ((function(SemanticTokenRule) {
|
|
113
|
+
function fromJSONObject(registry, o) {
|
|
114
|
+
if (o && typeof o._selector === 'string' && o._style) {
|
|
115
|
+
const style = TokenStyle.fromJSONObject(o._style);
|
|
116
|
+
if (style) {
|
|
117
|
+
try {
|
|
118
|
+
return { selector: registry.parseTokenSelector(o._selector), style };
|
|
119
|
+
}
|
|
120
|
+
catch (_ignore) {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
SemanticTokenRule.fromJSONObject = fromJSONObject;
|
|
127
|
+
function toJSONObject(rule) {
|
|
128
|
+
return {
|
|
129
|
+
_selector: rule.selector.id,
|
|
130
|
+
_style: TokenStyle.toJSONObject(rule.style)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
SemanticTokenRule.toJSONObject = toJSONObject;
|
|
134
|
+
function equals(r1, r2) {
|
|
135
|
+
if (r1 === r2) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
return r1 !== undefined && r2 !== undefined
|
|
139
|
+
&& r1.selector && r2.selector && r1.selector.id === r2.selector.id
|
|
140
|
+
&& TokenStyle.equals(r1.style, r2.style);
|
|
141
|
+
}
|
|
142
|
+
SemanticTokenRule.equals = equals;
|
|
143
|
+
function is(r) {
|
|
144
|
+
return r && r.selector && typeof r.selector.id === 'string' && TokenStyle.is(r.style);
|
|
145
|
+
}
|
|
146
|
+
SemanticTokenRule.is = is;
|
|
147
|
+
})(SemanticTokenRule || (SemanticTokenRule = {}))));
|
|
148
|
+
class TokenClassificationRegistry {
|
|
149
|
+
constructor() {
|
|
150
|
+
this._onDidChangeSchema = ( (new Emitter()));
|
|
151
|
+
this.onDidChangeSchema = this._onDidChangeSchema.event;
|
|
152
|
+
this.currentTypeNumber = 0;
|
|
153
|
+
this.currentModifierBit = 1;
|
|
154
|
+
this.tokenStylingDefaultRules = [];
|
|
155
|
+
this.tokenStylingSchema = {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {},
|
|
158
|
+
patternProperties: {
|
|
159
|
+
[selectorPattern]: getStylingSchemeEntry()
|
|
160
|
+
},
|
|
161
|
+
additionalProperties: false,
|
|
162
|
+
definitions: {
|
|
163
|
+
style: {
|
|
164
|
+
type: 'object',
|
|
165
|
+
description: ( (localize('schema.token.settings', 'Colors and styles for the token.'))),
|
|
166
|
+
properties: {
|
|
167
|
+
foreground: {
|
|
168
|
+
type: 'string',
|
|
169
|
+
description: ( (localize('schema.token.foreground', 'Foreground color for the token.'))),
|
|
170
|
+
format: 'color-hex',
|
|
171
|
+
default: '#ff0000'
|
|
172
|
+
},
|
|
173
|
+
background: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
deprecationMessage: ( (localize(
|
|
176
|
+
'schema.token.background.warning',
|
|
177
|
+
'Token background colors are currently not supported.'
|
|
178
|
+
)))
|
|
179
|
+
},
|
|
180
|
+
fontStyle: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
description: ( (localize(
|
|
183
|
+
'schema.token.fontStyle',
|
|
184
|
+
'Sets the all font styles of the rule: \'italic\', \'bold\', \'underline\' or \'strikethrough\' or a combination. All styles that are not listed are unset. The empty string unsets all styles.'
|
|
185
|
+
))),
|
|
186
|
+
pattern: fontStylePattern,
|
|
187
|
+
patternErrorMessage: ( (localize(
|
|
188
|
+
'schema.fontStyle.error',
|
|
189
|
+
'Font style must be \'italic\', \'bold\', \'underline\' or \'strikethrough\' or a combination. The empty string unsets all styles.'
|
|
190
|
+
))),
|
|
191
|
+
defaultSnippets: [
|
|
192
|
+
{ label: ( (localize('schema.token.fontStyle.none', 'None (clear inherited style)'))), bodyText: '""' },
|
|
193
|
+
{ body: 'italic' },
|
|
194
|
+
{ body: 'bold' },
|
|
195
|
+
{ body: 'underline' },
|
|
196
|
+
{ body: 'strikethrough' },
|
|
197
|
+
{ body: 'italic bold' },
|
|
198
|
+
{ body: 'italic underline' },
|
|
199
|
+
{ body: 'italic strikethrough' },
|
|
200
|
+
{ body: 'bold underline' },
|
|
201
|
+
{ body: 'bold strikethrough' },
|
|
202
|
+
{ body: 'underline strikethrough' },
|
|
203
|
+
{ body: 'italic bold underline' },
|
|
204
|
+
{ body: 'italic bold strikethrough' },
|
|
205
|
+
{ body: 'italic underline strikethrough' },
|
|
206
|
+
{ body: 'bold underline strikethrough' },
|
|
207
|
+
{ body: 'italic bold underline strikethrough' }
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
bold: {
|
|
211
|
+
type: 'boolean',
|
|
212
|
+
description: ( (localize(
|
|
213
|
+
'schema.token.bold',
|
|
214
|
+
'Sets or unsets the font style to bold. Note, the presence of \'fontStyle\' overrides this setting.'
|
|
215
|
+
))),
|
|
216
|
+
},
|
|
217
|
+
italic: {
|
|
218
|
+
type: 'boolean',
|
|
219
|
+
description: ( (localize(
|
|
220
|
+
'schema.token.italic',
|
|
221
|
+
'Sets or unsets the font style to italic. Note, the presence of \'fontStyle\' overrides this setting.'
|
|
222
|
+
))),
|
|
223
|
+
},
|
|
224
|
+
underline: {
|
|
225
|
+
type: 'boolean',
|
|
226
|
+
description: ( (localize(
|
|
227
|
+
'schema.token.underline',
|
|
228
|
+
'Sets or unsets the font style to underline. Note, the presence of \'fontStyle\' overrides this setting.'
|
|
229
|
+
))),
|
|
230
|
+
},
|
|
231
|
+
strikethrough: {
|
|
232
|
+
type: 'boolean',
|
|
233
|
+
description: ( (localize(
|
|
234
|
+
'schema.token.strikethrough',
|
|
235
|
+
'Sets or unsets the font style to strikethrough. Note, the presence of \'fontStyle\' overrides this setting.'
|
|
236
|
+
))),
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
defaultSnippets: [{ body: { foreground: '${1:#FF0000}', fontStyle: '${2:bold}' } }]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
this.tokenTypeById = Object.create(null);
|
|
244
|
+
this.tokenModifierById = Object.create(null);
|
|
245
|
+
this.typeHierarchy = Object.create(null);
|
|
246
|
+
}
|
|
247
|
+
registerTokenType(id, description, superType, deprecationMessage) {
|
|
248
|
+
if (!id.match(typeAndModifierIdPattern)) {
|
|
249
|
+
throw new Error('Invalid token type id.');
|
|
250
|
+
}
|
|
251
|
+
if (superType && !superType.match(typeAndModifierIdPattern)) {
|
|
252
|
+
throw new Error('Invalid token super type id.');
|
|
253
|
+
}
|
|
254
|
+
const num = this.currentTypeNumber++;
|
|
255
|
+
const tokenStyleContribution = { num, id, superType, description, deprecationMessage };
|
|
256
|
+
this.tokenTypeById[id] = tokenStyleContribution;
|
|
257
|
+
const stylingSchemeEntry = getStylingSchemeEntry(description, deprecationMessage);
|
|
258
|
+
this.tokenStylingSchema.properties[id] = stylingSchemeEntry;
|
|
259
|
+
this.typeHierarchy = Object.create(null);
|
|
260
|
+
}
|
|
261
|
+
registerTokenModifier(id, description, deprecationMessage) {
|
|
262
|
+
if (!id.match(typeAndModifierIdPattern)) {
|
|
263
|
+
throw new Error('Invalid token modifier id.');
|
|
264
|
+
}
|
|
265
|
+
const num = this.currentModifierBit;
|
|
266
|
+
this.currentModifierBit = this.currentModifierBit * 2;
|
|
267
|
+
const tokenStyleContribution = { num, id, description, deprecationMessage };
|
|
268
|
+
this.tokenModifierById[id] = tokenStyleContribution;
|
|
269
|
+
this.tokenStylingSchema.properties[`*.${id}`] = getStylingSchemeEntry(description, deprecationMessage);
|
|
270
|
+
}
|
|
271
|
+
parseTokenSelector(selectorString, language) {
|
|
272
|
+
const selector = parseClassifierString(selectorString, language);
|
|
273
|
+
if (!selector.type) {
|
|
274
|
+
return {
|
|
275
|
+
match: () => -1,
|
|
276
|
+
id: '$invalid'
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
match: (type, modifiers, language) => {
|
|
281
|
+
let score = 0;
|
|
282
|
+
if (selector.language !== undefined) {
|
|
283
|
+
if (selector.language !== language) {
|
|
284
|
+
return -1;
|
|
285
|
+
}
|
|
286
|
+
score += 10;
|
|
287
|
+
}
|
|
288
|
+
if (selector.type !== TOKEN_TYPE_WILDCARD) {
|
|
289
|
+
const hierarchy = this.getTypeHierarchy(type);
|
|
290
|
+
const level = hierarchy.indexOf(selector.type);
|
|
291
|
+
if (level === -1) {
|
|
292
|
+
return -1;
|
|
293
|
+
}
|
|
294
|
+
score += (100 - level);
|
|
295
|
+
}
|
|
296
|
+
for (const selectorModifier of selector.modifiers) {
|
|
297
|
+
if (modifiers.indexOf(selectorModifier) === -1) {
|
|
298
|
+
return -1;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return score + selector.modifiers.length * 100;
|
|
302
|
+
},
|
|
303
|
+
id: `${[selector.type, ...selector.modifiers.sort()].join('.')}${selector.language !== undefined ? ':' + selector.language : ''}`
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
registerTokenStyleDefault(selector, defaults) {
|
|
307
|
+
this.tokenStylingDefaultRules.push({ selector, defaults });
|
|
308
|
+
}
|
|
309
|
+
deregisterTokenStyleDefault(selector) {
|
|
310
|
+
const selectorString = selector.id;
|
|
311
|
+
this.tokenStylingDefaultRules = this.tokenStylingDefaultRules.filter(r => r.selector.id !== selectorString);
|
|
312
|
+
}
|
|
313
|
+
deregisterTokenType(id) {
|
|
314
|
+
delete this.tokenTypeById[id];
|
|
315
|
+
delete this.tokenStylingSchema.properties[id];
|
|
316
|
+
this.typeHierarchy = Object.create(null);
|
|
317
|
+
}
|
|
318
|
+
deregisterTokenModifier(id) {
|
|
319
|
+
delete this.tokenModifierById[id];
|
|
320
|
+
delete this.tokenStylingSchema.properties[`*.${id}`];
|
|
321
|
+
}
|
|
322
|
+
getTokenTypes() {
|
|
323
|
+
return ( (Object.keys(this.tokenTypeById))).map(id => this.tokenTypeById[id]);
|
|
324
|
+
}
|
|
325
|
+
getTokenModifiers() {
|
|
326
|
+
return ( (Object.keys(this.tokenModifierById))).map(id => this.tokenModifierById[id]);
|
|
327
|
+
}
|
|
328
|
+
getTokenStylingSchema() {
|
|
329
|
+
return this.tokenStylingSchema;
|
|
330
|
+
}
|
|
331
|
+
getTokenStylingDefaultRules() {
|
|
332
|
+
return this.tokenStylingDefaultRules;
|
|
333
|
+
}
|
|
334
|
+
getTypeHierarchy(typeId) {
|
|
335
|
+
let hierarchy = this.typeHierarchy[typeId];
|
|
336
|
+
if (!hierarchy) {
|
|
337
|
+
this.typeHierarchy[typeId] = hierarchy = [typeId];
|
|
338
|
+
let type = this.tokenTypeById[typeId];
|
|
339
|
+
while (type && type.superType) {
|
|
340
|
+
hierarchy.push(type.superType);
|
|
341
|
+
type = this.tokenTypeById[type.superType];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return hierarchy;
|
|
345
|
+
}
|
|
346
|
+
toString() {
|
|
347
|
+
const sorter = (a, b) => {
|
|
348
|
+
const cat1 = a.indexOf('.') === -1 ? 0 : 1;
|
|
349
|
+
const cat2 = b.indexOf('.') === -1 ? 0 : 1;
|
|
350
|
+
if (cat1 !== cat2) {
|
|
351
|
+
return cat1 - cat2;
|
|
352
|
+
}
|
|
353
|
+
return a.localeCompare(b);
|
|
354
|
+
};
|
|
355
|
+
return ( (Object.keys(this.tokenTypeById))).sort(sorter).map(k => `- \`${k}\`: ${this.tokenTypeById[k].description}`).join('\n');
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const CHAR_LANGUAGE = TOKEN_CLASSIFIER_LANGUAGE_SEPARATOR.charCodeAt(0);
|
|
359
|
+
const CHAR_MODIFIER = CLASSIFIER_MODIFIER_SEPARATOR.charCodeAt(0);
|
|
360
|
+
function parseClassifierString(s, defaultLanguage) {
|
|
361
|
+
let k = s.length;
|
|
362
|
+
let language = defaultLanguage;
|
|
363
|
+
const modifiers = [];
|
|
364
|
+
for (let i = k - 1; i >= 0; i--) {
|
|
365
|
+
const ch = s.charCodeAt(i);
|
|
366
|
+
if (ch === CHAR_LANGUAGE || ch === CHAR_MODIFIER) {
|
|
367
|
+
const segment = s.substring(i + 1, k);
|
|
368
|
+
k = i;
|
|
369
|
+
if (ch === CHAR_LANGUAGE) {
|
|
370
|
+
language = segment;
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
modifiers.push(segment);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const type = s.substring(0, k);
|
|
378
|
+
return { type, modifiers, language };
|
|
379
|
+
}
|
|
380
|
+
const tokenClassificationRegistry = createDefaultTokenClassificationRegistry();
|
|
381
|
+
function createDefaultTokenClassificationRegistry() {
|
|
382
|
+
const registry = ( (new TokenClassificationRegistry()));
|
|
383
|
+
function registerTokenType(id, description, scopesToProbe = [], superType, deprecationMessage) {
|
|
384
|
+
registry.registerTokenType(id, description, superType, deprecationMessage);
|
|
385
|
+
if (scopesToProbe) {
|
|
386
|
+
registerTokenStyleDefault(id, scopesToProbe);
|
|
387
|
+
}
|
|
388
|
+
return id;
|
|
389
|
+
}
|
|
390
|
+
function registerTokenStyleDefault(selectorString, scopesToProbe) {
|
|
391
|
+
try {
|
|
392
|
+
const selector = registry.parseTokenSelector(selectorString);
|
|
393
|
+
registry.registerTokenStyleDefault(selector, { scopesToProbe });
|
|
394
|
+
}
|
|
395
|
+
catch (e) {
|
|
396
|
+
console.log(e);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
registerTokenType('comment', ( (localize('comment', "Style for comments."))), [['comment']]);
|
|
400
|
+
registerTokenType('string', ( (localize('string', "Style for strings."))), [['string']]);
|
|
401
|
+
registerTokenType('keyword', ( (localize('keyword', "Style for keywords."))), [['keyword.control']]);
|
|
402
|
+
registerTokenType('number', ( (localize('number', "Style for numbers."))), [['constant.numeric']]);
|
|
403
|
+
registerTokenType('regexp', ( (localize('regexp', "Style for expressions."))), [['constant.regexp']]);
|
|
404
|
+
registerTokenType('operator', ( (localize('operator', "Style for operators."))), [['keyword.operator']]);
|
|
405
|
+
registerTokenType('namespace', ( (localize('namespace', "Style for namespaces."))), [['entity.name.namespace']]);
|
|
406
|
+
registerTokenType('type', ( (localize('type', "Style for types."))), [['entity.name.type'], ['support.type']]);
|
|
407
|
+
registerTokenType('struct', ( (localize('struct', "Style for structs."))), [['entity.name.type.struct']]);
|
|
408
|
+
registerTokenType('class', ( (localize('class', "Style for classes."))), [['entity.name.type.class'], ['support.class']]);
|
|
409
|
+
registerTokenType('interface', ( (localize('interface', "Style for interfaces."))), [['entity.name.type.interface']]);
|
|
410
|
+
registerTokenType('enum', ( (localize('enum', "Style for enums."))), [['entity.name.type.enum']]);
|
|
411
|
+
registerTokenType('typeParameter', ( (localize('typeParameter', "Style for type parameters."))), [['entity.name.type.parameter']]);
|
|
412
|
+
registerTokenType('function', ( (localize('function', "Style for functions"))), [['entity.name.function'], ['support.function']]);
|
|
413
|
+
registerTokenType('member', ( (localize('member', "Style for member functions"))), [], 'method', 'Deprecated use `method` instead');
|
|
414
|
+
registerTokenType('method', ( (localize('method', "Style for method (member functions)"))), [['entity.name.function.member'], ['support.function']]);
|
|
415
|
+
registerTokenType('macro', ( (localize('macro', "Style for macros."))), [['entity.name.function.preprocessor']]);
|
|
416
|
+
registerTokenType('variable', ( (localize('variable', "Style for variables."))), [['variable.other.readwrite'], ['entity.name.variable']]);
|
|
417
|
+
registerTokenType('parameter', ( (localize('parameter', "Style for parameters."))), [['variable.parameter']]);
|
|
418
|
+
registerTokenType('property', ( (localize('property', "Style for properties."))), [['variable.other.property']]);
|
|
419
|
+
registerTokenType('enumMember', ( (localize('enumMember', "Style for enum members."))), [['variable.other.enummember']]);
|
|
420
|
+
registerTokenType('event', ( (localize('event', "Style for events."))), [['variable.other.event']]);
|
|
421
|
+
registerTokenType('decorator', ( (localize('decorator', "Style for decorators & annotations."))), [['entity.name.decorator'], ['entity.name.function']]);
|
|
422
|
+
registerTokenType('label', ( (localize('labels', "Style for labels. "))), undefined);
|
|
423
|
+
registry.registerTokenModifier('declaration', ( (localize('declaration', "Style for all symbol declarations."))), undefined);
|
|
424
|
+
registry.registerTokenModifier('documentation', ( (localize('documentation', "Style to use for references in documentation."))), undefined);
|
|
425
|
+
registry.registerTokenModifier('static', ( (localize('static', "Style to use for symbols that are static."))), undefined);
|
|
426
|
+
registry.registerTokenModifier('abstract', ( (localize('abstract', "Style to use for symbols that are abstract."))), undefined);
|
|
427
|
+
registry.registerTokenModifier('deprecated', ( (localize('deprecated', "Style to use for symbols that are deprecated."))), undefined);
|
|
428
|
+
registry.registerTokenModifier('modification', ( (localize('modification', "Style to use for write accesses."))), undefined);
|
|
429
|
+
registry.registerTokenModifier('async', ( (localize('async', "Style to use for symbols that are async."))), undefined);
|
|
430
|
+
registry.registerTokenModifier('readonly', ( (localize('readonly', "Style to use for symbols that are readonly."))), undefined);
|
|
431
|
+
registerTokenStyleDefault('variable.readonly', [['variable.other.constant']]);
|
|
432
|
+
registerTokenStyleDefault('property.readonly', [['variable.other.constant.property']]);
|
|
433
|
+
registerTokenStyleDefault('type.defaultLibrary', [['support.type']]);
|
|
434
|
+
registerTokenStyleDefault('class.defaultLibrary', [['support.class']]);
|
|
435
|
+
registerTokenStyleDefault('interface.defaultLibrary', [['support.class']]);
|
|
436
|
+
registerTokenStyleDefault('variable.defaultLibrary', [['support.variable'], ['support.other.variable']]);
|
|
437
|
+
registerTokenStyleDefault('variable.defaultLibrary.readonly', [['support.constant']]);
|
|
438
|
+
registerTokenStyleDefault('property.defaultLibrary', [['support.variable.property']]);
|
|
439
|
+
registerTokenStyleDefault('property.defaultLibrary.readonly', [['support.constant.property']]);
|
|
440
|
+
registerTokenStyleDefault('function.defaultLibrary', [['support.function']]);
|
|
441
|
+
registerTokenStyleDefault('member.defaultLibrary', [['support.function']]);
|
|
442
|
+
return registry;
|
|
443
|
+
}
|
|
444
|
+
function getTokenClassificationRegistry() {
|
|
445
|
+
return tokenClassificationRegistry;
|
|
446
|
+
}
|
|
447
|
+
function getStylingSchemeEntry(description, deprecationMessage) {
|
|
448
|
+
return {
|
|
449
|
+
description,
|
|
450
|
+
deprecationMessage,
|
|
451
|
+
defaultSnippets: [{ body: '${1:#ff0000}' }],
|
|
452
|
+
anyOf: [
|
|
453
|
+
{
|
|
454
|
+
type: 'string',
|
|
455
|
+
format: 'color-hex'
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
$ref: '#/definitions/style'
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
const tokenStylingSchemaId = 'vscode://schemas/token-styling';
|
|
464
|
+
const schemaRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
465
|
+
schemaRegistry.registerSchema(tokenStylingSchemaId, tokenClassificationRegistry.getTokenStylingSchema());
|
|
466
|
+
const delayer = ( (new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(tokenStylingSchemaId), 200)));
|
|
467
|
+
tokenClassificationRegistry.onDidChangeSchema(() => {
|
|
468
|
+
if (!delayer.isScheduled()) {
|
|
469
|
+
delayer.schedule();
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
export { SemanticTokenRule as S, TokenStyle as T, typeAndModifierIdPattern as a, getTokenClassificationRegistry as g, parseClassifierString as p, tokenStylingSchemaId as t };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { h as ExtensionsRegistry } from './missing-services.js';
|
|
2
|
+
import { EventEmitter } from 'vscode';
|
|
3
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
4
|
+
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
5
|
+
function consoleExtensionMessageHandler(msg) {
|
|
6
|
+
if (msg.type === Severity.Error) {
|
|
7
|
+
console.error(msg);
|
|
8
|
+
}
|
|
9
|
+
else if (msg.type === Severity.Warning) {
|
|
10
|
+
console.warn(msg);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
console.log(msg);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function getExtensionPoint(extensionPoint) {
|
|
17
|
+
return ExtensionsRegistry.getExtensionPoints().find(ep => ep.name === extensionPoint);
|
|
18
|
+
}
|
|
19
|
+
const emitter = new EventEmitter();
|
|
20
|
+
const onServicesInitialized = emitter.event;
|
|
21
|
+
let initialized = false;
|
|
22
|
+
const original = StandaloneServices.initialize;
|
|
23
|
+
StandaloneServices.initialize = (overrides) => {
|
|
24
|
+
const instantiationService = original.call(StandaloneServices, overrides);
|
|
25
|
+
if (!initialized) {
|
|
26
|
+
initialized = true;
|
|
27
|
+
emitter.fire(instantiationService);
|
|
28
|
+
}
|
|
29
|
+
return instantiationService;
|
|
30
|
+
};
|
|
31
|
+
export { consoleExtensionMessageHandler as c, getExtensionPoint as g, onServicesInitialized as o };
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
}
|
|
15
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
16
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
18
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
19
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
20
|
+
}
|
|
21
|
+
export { __decorate as _, __param as a, __classPrivateFieldSet as b, __classPrivateFieldGet as c };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { r as refineServiceDecorator } from './services2.js';
|
|
2
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
3
|
+
import { isString, isBoolean } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
4
|
+
const IWorkbenchThemeService = refineServiceDecorator(IThemeService);
|
|
5
|
+
const VS_LIGHT_THEME = 'vs';
|
|
6
|
+
const VS_DARK_THEME = 'vs-dark';
|
|
7
|
+
const VS_HC_THEME = 'hc-black';
|
|
8
|
+
const VS_HC_LIGHT_THEME = 'hc-light';
|
|
9
|
+
const THEME_SCOPE_OPEN_PAREN = '[';
|
|
10
|
+
const THEME_SCOPE_CLOSE_PAREN = ']';
|
|
11
|
+
const THEME_SCOPE_WILDCARD = '*';
|
|
12
|
+
const themeScopeRegex = /\[(.+?)\]/g;
|
|
13
|
+
var ThemeSettings;
|
|
14
|
+
( (function(ThemeSettings) {
|
|
15
|
+
ThemeSettings["COLOR_THEME"] = "workbench.colorTheme";
|
|
16
|
+
ThemeSettings["FILE_ICON_THEME"] = "workbench.iconTheme";
|
|
17
|
+
ThemeSettings["PRODUCT_ICON_THEME"] = "workbench.productIconTheme";
|
|
18
|
+
ThemeSettings["COLOR_CUSTOMIZATIONS"] = "workbench.colorCustomizations";
|
|
19
|
+
ThemeSettings["TOKEN_COLOR_CUSTOMIZATIONS"] = "editor.tokenColorCustomizations";
|
|
20
|
+
ThemeSettings["SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS"] = "editor.semanticTokenColorCustomizations";
|
|
21
|
+
ThemeSettings["PREFERRED_DARK_THEME"] = "workbench.preferredDarkColorTheme";
|
|
22
|
+
ThemeSettings["PREFERRED_LIGHT_THEME"] = "workbench.preferredLightColorTheme";
|
|
23
|
+
ThemeSettings["PREFERRED_HC_DARK_THEME"] = "workbench.preferredHighContrastColorTheme";
|
|
24
|
+
ThemeSettings["PREFERRED_HC_LIGHT_THEME"] = "workbench.preferredHighContrastLightColorTheme";
|
|
25
|
+
ThemeSettings["DETECT_COLOR_SCHEME"] = "window.autoDetectColorScheme";
|
|
26
|
+
ThemeSettings["DETECT_HC"] = "window.autoDetectHighContrast";
|
|
27
|
+
})(ThemeSettings || (ThemeSettings = {})));
|
|
28
|
+
var ExtensionData;
|
|
29
|
+
( (function(ExtensionData) {
|
|
30
|
+
function toJSONObject(d) {
|
|
31
|
+
return d && { _extensionId: d.extensionId, _extensionIsBuiltin: d.extensionIsBuiltin, _extensionName: d.extensionName, _extensionPublisher: d.extensionPublisher };
|
|
32
|
+
}
|
|
33
|
+
ExtensionData.toJSONObject = toJSONObject;
|
|
34
|
+
function fromJSONObject(o) {
|
|
35
|
+
if (o && isString(o._extensionId) && isBoolean(o._extensionIsBuiltin) && isString(o._extensionName) && isString(o._extensionPublisher)) {
|
|
36
|
+
return { extensionId: o._extensionId, extensionIsBuiltin: o._extensionIsBuiltin, extensionName: o._extensionName, extensionPublisher: o._extensionPublisher };
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
ExtensionData.fromJSONObject = fromJSONObject;
|
|
41
|
+
function fromName(publisher, name, isBuiltin = false) {
|
|
42
|
+
return { extensionPublisher: publisher, extensionId: `${publisher}.${name}`, extensionName: name, extensionIsBuiltin: isBuiltin };
|
|
43
|
+
}
|
|
44
|
+
ExtensionData.fromName = fromName;
|
|
45
|
+
})(ExtensionData || (ExtensionData = {})));
|
|
46
|
+
export { ExtensionData as E, IWorkbenchThemeService as I, ThemeSettings as T, VS_DARK_THEME as V, VS_LIGHT_THEME as a, VS_HC_THEME as b, VS_HC_LIGHT_THEME as c, THEME_SCOPE_OPEN_PAREN as d, THEME_SCOPE_CLOSE_PAREN as e, THEME_SCOPE_WILDCARD as f, themeScopeRegex as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { u as unsupported } from './missing-services.js';
|
|
2
|
+
import { S as Services } from './services2.js';
|
|
3
|
+
import { IWorkspaceContextService, WorkspaceFolder } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
4
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
5
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
6
|
+
class SimpleWorkspaceContextService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.onDidChangeWorkspaceName = Event.None;
|
|
9
|
+
this.onWillChangeWorkspaceFolders = Event.None;
|
|
10
|
+
this.onDidChangeWorkspaceFolders = Event.None;
|
|
11
|
+
this.onDidChangeWorkbenchState = Event.None;
|
|
12
|
+
this.isCurrentWorkspace = unsupported;
|
|
13
|
+
}
|
|
14
|
+
getCompleteWorkspace() {
|
|
15
|
+
return Promise.resolve(this.getWorkspace());
|
|
16
|
+
}
|
|
17
|
+
getWorkspace() {
|
|
18
|
+
const workspaceFolders = Services.get().workspace?.workspaceFolders;
|
|
19
|
+
return {
|
|
20
|
+
id: '4064f6ec-cb38-4ad0-af64-ee6467e63c82',
|
|
21
|
+
folders: workspaceFolders?.map(folder => new WorkspaceFolder(folder)) ?? []
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
getWorkbenchState() {
|
|
25
|
+
const workspaceFoldersCount = Services.get().workspace?.workspaceFolders?.length ?? 1;
|
|
26
|
+
if (workspaceFoldersCount === 0) {
|
|
27
|
+
return 1 ;
|
|
28
|
+
}
|
|
29
|
+
else if (workspaceFoldersCount === 1) {
|
|
30
|
+
return 2 ;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return 3 ;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
getWorkspaceFolder(resource) {
|
|
37
|
+
const workspace = this.getWorkspace();
|
|
38
|
+
return workspace.folders.find(folder => folder.uri.scheme === resource.scheme && resource.path.startsWith(folder.uri.path)) ?? null;
|
|
39
|
+
}
|
|
40
|
+
isInsideWorkspace(resource) {
|
|
41
|
+
return this.getWorkspaceFolder(resource) != null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function getServiceOverride() {
|
|
45
|
+
return {
|
|
46
|
+
[( IWorkspaceContextService.toString())]: new SyncDescriptor(SimpleWorkspaceContextService)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export { getServiceOverride as g };
|