@arcgis/coding-components 1.0.0-beta.10 → 1.0.0-beta.11
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/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +22 -22
- package/dist/arcgis-coding-components/p-4d7cdaf4.js +1 -0
- package/dist/arcgis-coding-components/{p-dd456524.entry.js → p-9a6baa15.entry.js} +1 -1
- package/dist/cjs/arcade-mode-4b1d5adc.js +600 -0
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1 -1
- package/dist/components/arcade-mode.js +38 -1556
- package/dist/esm/arcade-mode-dc10ed9f.js +596 -0
- package/dist/esm/arcgis-arcade-api_6.entry.js +1 -1
- package/package.json +3 -3
- package/dist/arcgis-coding-components/p-b53f7f32.js +0 -1
- package/dist/cjs/arcade-mode-1eb92a78.js +0 -2118
- package/dist/esm/arcade-mode-6ae88544.js +0 -2114
|
@@ -1,2118 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const arcadeDefaults = require('./arcade-defaults-f77b7bae.js');
|
|
4
|
-
require('./index-f8a85eb8.js');
|
|
5
|
-
|
|
6
|
-
// src/services/api-context.ts
|
|
7
|
-
|
|
8
|
-
// ../arcade-parser/dist/esm/index.js
|
|
9
|
-
var Literals = /* @__PURE__ */ ((Literals2) => {
|
|
10
|
-
Literals2["False"] = "false";
|
|
11
|
-
Literals2["Null"] = "null";
|
|
12
|
-
Literals2["True"] = "true";
|
|
13
|
-
return Literals2;
|
|
14
|
-
})(Literals || {});
|
|
15
|
-
var Keywords = /* @__PURE__ */ ((Keywords2) => {
|
|
16
|
-
Keywords2["Break"] = "break";
|
|
17
|
-
Keywords2["Continue"] = "continue";
|
|
18
|
-
Keywords2["Else"] = "else";
|
|
19
|
-
Keywords2["For"] = "for";
|
|
20
|
-
Keywords2["From"] = "from";
|
|
21
|
-
Keywords2["Function"] = "function";
|
|
22
|
-
Keywords2["If"] = "if";
|
|
23
|
-
Keywords2["Import"] = "import";
|
|
24
|
-
Keywords2["Export"] = "export";
|
|
25
|
-
Keywords2["In"] = "in";
|
|
26
|
-
Keywords2["Return"] = "return";
|
|
27
|
-
Keywords2["Var"] = "var";
|
|
28
|
-
Keywords2["While"] = "while";
|
|
29
|
-
return Keywords2;
|
|
30
|
-
})(Keywords || {});
|
|
31
|
-
var UpdateOperators = ["++", "--"];
|
|
32
|
-
var UnaryOperators = ["-", "+", "!", "~"];
|
|
33
|
-
var AssignmentOperators = ["=", "/=", "*=", "%=", "+=", "-="];
|
|
34
|
-
var LogicalOperators = ["||", "&&"];
|
|
35
|
-
var BinaryOperators = [
|
|
36
|
-
"|",
|
|
37
|
-
"&",
|
|
38
|
-
">>",
|
|
39
|
-
"<<",
|
|
40
|
-
">>>",
|
|
41
|
-
"^",
|
|
42
|
-
"==",
|
|
43
|
-
"!=",
|
|
44
|
-
"<",
|
|
45
|
-
"<=",
|
|
46
|
-
">",
|
|
47
|
-
">=",
|
|
48
|
-
"+",
|
|
49
|
-
"-",
|
|
50
|
-
"*",
|
|
51
|
-
"/",
|
|
52
|
-
"%"
|
|
53
|
-
];
|
|
54
|
-
var OperatorsByLength = [[], [], []];
|
|
55
|
-
UpdateOperators.forEach((op) => OperatorsByLength[op.length - 1].push(op));
|
|
56
|
-
UnaryOperators.forEach((op) => OperatorsByLength[op.length - 1].push(op));
|
|
57
|
-
LogicalOperators.forEach((op) => OperatorsByLength[op.length - 1].push(op));
|
|
58
|
-
AssignmentOperators.forEach((op) => OperatorsByLength[op.length - 1].push(op));
|
|
59
|
-
BinaryOperators.forEach((op) => OperatorsByLength[op.length - 1].push(op));
|
|
60
|
-
|
|
61
|
-
// ../../../node_modules/vscode-languageserver-types/lib/esm/main.js
|
|
62
|
-
var DocumentUri;
|
|
63
|
-
(function(DocumentUri2) {
|
|
64
|
-
function is(value) {
|
|
65
|
-
return typeof value === "string";
|
|
66
|
-
}
|
|
67
|
-
DocumentUri2.is = is;
|
|
68
|
-
})(DocumentUri || (DocumentUri = {}));
|
|
69
|
-
var URI;
|
|
70
|
-
(function(URI2) {
|
|
71
|
-
function is(value) {
|
|
72
|
-
return typeof value === "string";
|
|
73
|
-
}
|
|
74
|
-
URI2.is = is;
|
|
75
|
-
})(URI || (URI = {}));
|
|
76
|
-
var integer;
|
|
77
|
-
(function(integer2) {
|
|
78
|
-
integer2.MIN_VALUE = -2147483648;
|
|
79
|
-
integer2.MAX_VALUE = 2147483647;
|
|
80
|
-
function is(value) {
|
|
81
|
-
return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE;
|
|
82
|
-
}
|
|
83
|
-
integer2.is = is;
|
|
84
|
-
})(integer || (integer = {}));
|
|
85
|
-
var uinteger;
|
|
86
|
-
(function(uinteger2) {
|
|
87
|
-
uinteger2.MIN_VALUE = 0;
|
|
88
|
-
uinteger2.MAX_VALUE = 2147483647;
|
|
89
|
-
function is(value) {
|
|
90
|
-
return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE;
|
|
91
|
-
}
|
|
92
|
-
uinteger2.is = is;
|
|
93
|
-
})(uinteger || (uinteger = {}));
|
|
94
|
-
var Position;
|
|
95
|
-
(function(Position4) {
|
|
96
|
-
function create(line, character) {
|
|
97
|
-
if (line === Number.MAX_VALUE) {
|
|
98
|
-
line = uinteger.MAX_VALUE;
|
|
99
|
-
}
|
|
100
|
-
if (character === Number.MAX_VALUE) {
|
|
101
|
-
character = uinteger.MAX_VALUE;
|
|
102
|
-
}
|
|
103
|
-
return { line, character };
|
|
104
|
-
}
|
|
105
|
-
Position4.create = create;
|
|
106
|
-
function is(value) {
|
|
107
|
-
var candidate = value;
|
|
108
|
-
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
|
|
109
|
-
}
|
|
110
|
-
Position4.is = is;
|
|
111
|
-
})(Position || (Position = {}));
|
|
112
|
-
var Range;
|
|
113
|
-
(function(Range3) {
|
|
114
|
-
function create(one, two, three, four) {
|
|
115
|
-
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
|
|
116
|
-
return { start: Position.create(one, two), end: Position.create(three, four) };
|
|
117
|
-
} else if (Position.is(one) && Position.is(two)) {
|
|
118
|
-
return { start: one, end: two };
|
|
119
|
-
} else {
|
|
120
|
-
throw new Error("Range#create called with invalid arguments[".concat(one, ", ").concat(two, ", ").concat(three, ", ").concat(four, "]"));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
Range3.create = create;
|
|
124
|
-
function is(value) {
|
|
125
|
-
var candidate = value;
|
|
126
|
-
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
|
|
127
|
-
}
|
|
128
|
-
Range3.is = is;
|
|
129
|
-
})(Range || (Range = {}));
|
|
130
|
-
var Location;
|
|
131
|
-
(function(Location2) {
|
|
132
|
-
function create(uri, range) {
|
|
133
|
-
return { uri, range };
|
|
134
|
-
}
|
|
135
|
-
Location2.create = create;
|
|
136
|
-
function is(value) {
|
|
137
|
-
var candidate = value;
|
|
138
|
-
return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
|
|
139
|
-
}
|
|
140
|
-
Location2.is = is;
|
|
141
|
-
})(Location || (Location = {}));
|
|
142
|
-
var LocationLink;
|
|
143
|
-
(function(LocationLink2) {
|
|
144
|
-
function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
|
|
145
|
-
return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
|
|
146
|
-
}
|
|
147
|
-
LocationLink2.create = create;
|
|
148
|
-
function is(value) {
|
|
149
|
-
var candidate = value;
|
|
150
|
-
return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
|
|
151
|
-
}
|
|
152
|
-
LocationLink2.is = is;
|
|
153
|
-
})(LocationLink || (LocationLink = {}));
|
|
154
|
-
var Color;
|
|
155
|
-
(function(Color2) {
|
|
156
|
-
function create(red, green, blue, alpha) {
|
|
157
|
-
return {
|
|
158
|
-
red,
|
|
159
|
-
green,
|
|
160
|
-
blue,
|
|
161
|
-
alpha
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
Color2.create = create;
|
|
165
|
-
function is(value) {
|
|
166
|
-
var candidate = value;
|
|
167
|
-
return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
|
|
168
|
-
}
|
|
169
|
-
Color2.is = is;
|
|
170
|
-
})(Color || (Color = {}));
|
|
171
|
-
var ColorInformation;
|
|
172
|
-
(function(ColorInformation2) {
|
|
173
|
-
function create(range, color) {
|
|
174
|
-
return {
|
|
175
|
-
range,
|
|
176
|
-
color
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
ColorInformation2.create = create;
|
|
180
|
-
function is(value) {
|
|
181
|
-
var candidate = value;
|
|
182
|
-
return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
|
|
183
|
-
}
|
|
184
|
-
ColorInformation2.is = is;
|
|
185
|
-
})(ColorInformation || (ColorInformation = {}));
|
|
186
|
-
var ColorPresentation;
|
|
187
|
-
(function(ColorPresentation2) {
|
|
188
|
-
function create(label, textEdit, additionalTextEdits) {
|
|
189
|
-
return {
|
|
190
|
-
label,
|
|
191
|
-
textEdit,
|
|
192
|
-
additionalTextEdits
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
ColorPresentation2.create = create;
|
|
196
|
-
function is(value) {
|
|
197
|
-
var candidate = value;
|
|
198
|
-
return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
|
|
199
|
-
}
|
|
200
|
-
ColorPresentation2.is = is;
|
|
201
|
-
})(ColorPresentation || (ColorPresentation = {}));
|
|
202
|
-
var FoldingRangeKind;
|
|
203
|
-
(function(FoldingRangeKind2) {
|
|
204
|
-
FoldingRangeKind2.Comment = "comment";
|
|
205
|
-
FoldingRangeKind2.Imports = "imports";
|
|
206
|
-
FoldingRangeKind2.Region = "region";
|
|
207
|
-
})(FoldingRangeKind || (FoldingRangeKind = {}));
|
|
208
|
-
var FoldingRange;
|
|
209
|
-
(function(FoldingRange2) {
|
|
210
|
-
function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
|
|
211
|
-
var result = {
|
|
212
|
-
startLine,
|
|
213
|
-
endLine
|
|
214
|
-
};
|
|
215
|
-
if (Is.defined(startCharacter)) {
|
|
216
|
-
result.startCharacter = startCharacter;
|
|
217
|
-
}
|
|
218
|
-
if (Is.defined(endCharacter)) {
|
|
219
|
-
result.endCharacter = endCharacter;
|
|
220
|
-
}
|
|
221
|
-
if (Is.defined(kind)) {
|
|
222
|
-
result.kind = kind;
|
|
223
|
-
}
|
|
224
|
-
if (Is.defined(collapsedText)) {
|
|
225
|
-
result.collapsedText = collapsedText;
|
|
226
|
-
}
|
|
227
|
-
return result;
|
|
228
|
-
}
|
|
229
|
-
FoldingRange2.create = create;
|
|
230
|
-
function is(value) {
|
|
231
|
-
var candidate = value;
|
|
232
|
-
return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
|
|
233
|
-
}
|
|
234
|
-
FoldingRange2.is = is;
|
|
235
|
-
})(FoldingRange || (FoldingRange = {}));
|
|
236
|
-
var DiagnosticRelatedInformation;
|
|
237
|
-
(function(DiagnosticRelatedInformation2) {
|
|
238
|
-
function create(location, message) {
|
|
239
|
-
return {
|
|
240
|
-
location,
|
|
241
|
-
message
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
DiagnosticRelatedInformation2.create = create;
|
|
245
|
-
function is(value) {
|
|
246
|
-
var candidate = value;
|
|
247
|
-
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
|
|
248
|
-
}
|
|
249
|
-
DiagnosticRelatedInformation2.is = is;
|
|
250
|
-
})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
|
|
251
|
-
var DiagnosticSeverity;
|
|
252
|
-
(function(DiagnosticSeverity2) {
|
|
253
|
-
DiagnosticSeverity2.Error = 1;
|
|
254
|
-
DiagnosticSeverity2.Warning = 2;
|
|
255
|
-
DiagnosticSeverity2.Information = 3;
|
|
256
|
-
DiagnosticSeverity2.Hint = 4;
|
|
257
|
-
})(DiagnosticSeverity || (DiagnosticSeverity = {}));
|
|
258
|
-
var DiagnosticTag;
|
|
259
|
-
(function(DiagnosticTag2) {
|
|
260
|
-
DiagnosticTag2.Unnecessary = 1;
|
|
261
|
-
DiagnosticTag2.Deprecated = 2;
|
|
262
|
-
})(DiagnosticTag || (DiagnosticTag = {}));
|
|
263
|
-
var CodeDescription;
|
|
264
|
-
(function(CodeDescription2) {
|
|
265
|
-
function is(value) {
|
|
266
|
-
var candidate = value;
|
|
267
|
-
return Is.objectLiteral(candidate) && Is.string(candidate.href);
|
|
268
|
-
}
|
|
269
|
-
CodeDescription2.is = is;
|
|
270
|
-
})(CodeDescription || (CodeDescription = {}));
|
|
271
|
-
var Diagnostic2;
|
|
272
|
-
(function(Diagnostic4) {
|
|
273
|
-
function create(range, message, severity, code, source, relatedInformation) {
|
|
274
|
-
var result = { range, message };
|
|
275
|
-
if (Is.defined(severity)) {
|
|
276
|
-
result.severity = severity;
|
|
277
|
-
}
|
|
278
|
-
if (Is.defined(code)) {
|
|
279
|
-
result.code = code;
|
|
280
|
-
}
|
|
281
|
-
if (Is.defined(source)) {
|
|
282
|
-
result.source = source;
|
|
283
|
-
}
|
|
284
|
-
if (Is.defined(relatedInformation)) {
|
|
285
|
-
result.relatedInformation = relatedInformation;
|
|
286
|
-
}
|
|
287
|
-
return result;
|
|
288
|
-
}
|
|
289
|
-
Diagnostic4.create = create;
|
|
290
|
-
function is(value) {
|
|
291
|
-
var _a;
|
|
292
|
-
var candidate = value;
|
|
293
|
-
return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
|
|
294
|
-
}
|
|
295
|
-
Diagnostic4.is = is;
|
|
296
|
-
})(Diagnostic2 || (Diagnostic2 = {}));
|
|
297
|
-
var Command;
|
|
298
|
-
(function(Command2) {
|
|
299
|
-
function create(title, command) {
|
|
300
|
-
var args = [];
|
|
301
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
302
|
-
args[_i - 2] = arguments[_i];
|
|
303
|
-
}
|
|
304
|
-
var result = { title, command };
|
|
305
|
-
if (Is.defined(args) && args.length > 0) {
|
|
306
|
-
result.arguments = args;
|
|
307
|
-
}
|
|
308
|
-
return result;
|
|
309
|
-
}
|
|
310
|
-
Command2.create = create;
|
|
311
|
-
function is(value) {
|
|
312
|
-
var candidate = value;
|
|
313
|
-
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
|
|
314
|
-
}
|
|
315
|
-
Command2.is = is;
|
|
316
|
-
})(Command || (Command = {}));
|
|
317
|
-
var TextEdit;
|
|
318
|
-
(function(TextEdit2) {
|
|
319
|
-
function replace(range, newText) {
|
|
320
|
-
return { range, newText };
|
|
321
|
-
}
|
|
322
|
-
TextEdit2.replace = replace;
|
|
323
|
-
function insert(position, newText) {
|
|
324
|
-
return { range: { start: position, end: position }, newText };
|
|
325
|
-
}
|
|
326
|
-
TextEdit2.insert = insert;
|
|
327
|
-
function del(range) {
|
|
328
|
-
return { range, newText: "" };
|
|
329
|
-
}
|
|
330
|
-
TextEdit2.del = del;
|
|
331
|
-
function is(value) {
|
|
332
|
-
var candidate = value;
|
|
333
|
-
return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
|
|
334
|
-
}
|
|
335
|
-
TextEdit2.is = is;
|
|
336
|
-
})(TextEdit || (TextEdit = {}));
|
|
337
|
-
var ChangeAnnotation;
|
|
338
|
-
(function(ChangeAnnotation2) {
|
|
339
|
-
function create(label, needsConfirmation, description) {
|
|
340
|
-
var result = { label };
|
|
341
|
-
if (needsConfirmation !== void 0) {
|
|
342
|
-
result.needsConfirmation = needsConfirmation;
|
|
343
|
-
}
|
|
344
|
-
if (description !== void 0) {
|
|
345
|
-
result.description = description;
|
|
346
|
-
}
|
|
347
|
-
return result;
|
|
348
|
-
}
|
|
349
|
-
ChangeAnnotation2.create = create;
|
|
350
|
-
function is(value) {
|
|
351
|
-
var candidate = value;
|
|
352
|
-
return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
|
|
353
|
-
}
|
|
354
|
-
ChangeAnnotation2.is = is;
|
|
355
|
-
})(ChangeAnnotation || (ChangeAnnotation = {}));
|
|
356
|
-
var ChangeAnnotationIdentifier;
|
|
357
|
-
(function(ChangeAnnotationIdentifier2) {
|
|
358
|
-
function is(value) {
|
|
359
|
-
var candidate = value;
|
|
360
|
-
return Is.string(candidate);
|
|
361
|
-
}
|
|
362
|
-
ChangeAnnotationIdentifier2.is = is;
|
|
363
|
-
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
|
|
364
|
-
var AnnotatedTextEdit;
|
|
365
|
-
(function(AnnotatedTextEdit2) {
|
|
366
|
-
function replace(range, newText, annotation) {
|
|
367
|
-
return { range, newText, annotationId: annotation };
|
|
368
|
-
}
|
|
369
|
-
AnnotatedTextEdit2.replace = replace;
|
|
370
|
-
function insert(position, newText, annotation) {
|
|
371
|
-
return { range: { start: position, end: position }, newText, annotationId: annotation };
|
|
372
|
-
}
|
|
373
|
-
AnnotatedTextEdit2.insert = insert;
|
|
374
|
-
function del(range, annotation) {
|
|
375
|
-
return { range, newText: "", annotationId: annotation };
|
|
376
|
-
}
|
|
377
|
-
AnnotatedTextEdit2.del = del;
|
|
378
|
-
function is(value) {
|
|
379
|
-
var candidate = value;
|
|
380
|
-
return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
|
381
|
-
}
|
|
382
|
-
AnnotatedTextEdit2.is = is;
|
|
383
|
-
})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
|
|
384
|
-
var TextDocumentEdit;
|
|
385
|
-
(function(TextDocumentEdit2) {
|
|
386
|
-
function create(textDocument, edits) {
|
|
387
|
-
return { textDocument, edits };
|
|
388
|
-
}
|
|
389
|
-
TextDocumentEdit2.create = create;
|
|
390
|
-
function is(value) {
|
|
391
|
-
var candidate = value;
|
|
392
|
-
return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
|
|
393
|
-
}
|
|
394
|
-
TextDocumentEdit2.is = is;
|
|
395
|
-
})(TextDocumentEdit || (TextDocumentEdit = {}));
|
|
396
|
-
var CreateFile;
|
|
397
|
-
(function(CreateFile2) {
|
|
398
|
-
function create(uri, options, annotation) {
|
|
399
|
-
var result = {
|
|
400
|
-
kind: "create",
|
|
401
|
-
uri
|
|
402
|
-
};
|
|
403
|
-
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
|
|
404
|
-
result.options = options;
|
|
405
|
-
}
|
|
406
|
-
if (annotation !== void 0) {
|
|
407
|
-
result.annotationId = annotation;
|
|
408
|
-
}
|
|
409
|
-
return result;
|
|
410
|
-
}
|
|
411
|
-
CreateFile2.create = create;
|
|
412
|
-
function is(value) {
|
|
413
|
-
var candidate = value;
|
|
414
|
-
return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
|
415
|
-
}
|
|
416
|
-
CreateFile2.is = is;
|
|
417
|
-
})(CreateFile || (CreateFile = {}));
|
|
418
|
-
var RenameFile;
|
|
419
|
-
(function(RenameFile2) {
|
|
420
|
-
function create(oldUri, newUri, options, annotation) {
|
|
421
|
-
var result = {
|
|
422
|
-
kind: "rename",
|
|
423
|
-
oldUri,
|
|
424
|
-
newUri
|
|
425
|
-
};
|
|
426
|
-
if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
|
|
427
|
-
result.options = options;
|
|
428
|
-
}
|
|
429
|
-
if (annotation !== void 0) {
|
|
430
|
-
result.annotationId = annotation;
|
|
431
|
-
}
|
|
432
|
-
return result;
|
|
433
|
-
}
|
|
434
|
-
RenameFile2.create = create;
|
|
435
|
-
function is(value) {
|
|
436
|
-
var candidate = value;
|
|
437
|
-
return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
|
438
|
-
}
|
|
439
|
-
RenameFile2.is = is;
|
|
440
|
-
})(RenameFile || (RenameFile = {}));
|
|
441
|
-
var DeleteFile;
|
|
442
|
-
(function(DeleteFile2) {
|
|
443
|
-
function create(uri, options, annotation) {
|
|
444
|
-
var result = {
|
|
445
|
-
kind: "delete",
|
|
446
|
-
uri
|
|
447
|
-
};
|
|
448
|
-
if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
|
|
449
|
-
result.options = options;
|
|
450
|
-
}
|
|
451
|
-
if (annotation !== void 0) {
|
|
452
|
-
result.annotationId = annotation;
|
|
453
|
-
}
|
|
454
|
-
return result;
|
|
455
|
-
}
|
|
456
|
-
DeleteFile2.create = create;
|
|
457
|
-
function is(value) {
|
|
458
|
-
var candidate = value;
|
|
459
|
-
return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
|
460
|
-
}
|
|
461
|
-
DeleteFile2.is = is;
|
|
462
|
-
})(DeleteFile || (DeleteFile = {}));
|
|
463
|
-
var WorkspaceEdit;
|
|
464
|
-
(function(WorkspaceEdit2) {
|
|
465
|
-
function is(value) {
|
|
466
|
-
var candidate = value;
|
|
467
|
-
return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) {
|
|
468
|
-
if (Is.string(change.kind)) {
|
|
469
|
-
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
|
|
470
|
-
} else {
|
|
471
|
-
return TextDocumentEdit.is(change);
|
|
472
|
-
}
|
|
473
|
-
}));
|
|
474
|
-
}
|
|
475
|
-
WorkspaceEdit2.is = is;
|
|
476
|
-
})(WorkspaceEdit || (WorkspaceEdit = {}));
|
|
477
|
-
var TextEditChangeImpl = (
|
|
478
|
-
/** @class */
|
|
479
|
-
function() {
|
|
480
|
-
function TextEditChangeImpl2(edits, changeAnnotations) {
|
|
481
|
-
this.edits = edits;
|
|
482
|
-
this.changeAnnotations = changeAnnotations;
|
|
483
|
-
}
|
|
484
|
-
TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) {
|
|
485
|
-
var edit;
|
|
486
|
-
var id;
|
|
487
|
-
if (annotation === void 0) {
|
|
488
|
-
edit = TextEdit.insert(position, newText);
|
|
489
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
490
|
-
id = annotation;
|
|
491
|
-
edit = AnnotatedTextEdit.insert(position, newText, annotation);
|
|
492
|
-
} else {
|
|
493
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
494
|
-
id = this.changeAnnotations.manage(annotation);
|
|
495
|
-
edit = AnnotatedTextEdit.insert(position, newText, id);
|
|
496
|
-
}
|
|
497
|
-
this.edits.push(edit);
|
|
498
|
-
if (id !== void 0) {
|
|
499
|
-
return id;
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) {
|
|
503
|
-
var edit;
|
|
504
|
-
var id;
|
|
505
|
-
if (annotation === void 0) {
|
|
506
|
-
edit = TextEdit.replace(range, newText);
|
|
507
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
508
|
-
id = annotation;
|
|
509
|
-
edit = AnnotatedTextEdit.replace(range, newText, annotation);
|
|
510
|
-
} else {
|
|
511
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
512
|
-
id = this.changeAnnotations.manage(annotation);
|
|
513
|
-
edit = AnnotatedTextEdit.replace(range, newText, id);
|
|
514
|
-
}
|
|
515
|
-
this.edits.push(edit);
|
|
516
|
-
if (id !== void 0) {
|
|
517
|
-
return id;
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
TextEditChangeImpl2.prototype.delete = function(range, annotation) {
|
|
521
|
-
var edit;
|
|
522
|
-
var id;
|
|
523
|
-
if (annotation === void 0) {
|
|
524
|
-
edit = TextEdit.del(range);
|
|
525
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
526
|
-
id = annotation;
|
|
527
|
-
edit = AnnotatedTextEdit.del(range, annotation);
|
|
528
|
-
} else {
|
|
529
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
530
|
-
id = this.changeAnnotations.manage(annotation);
|
|
531
|
-
edit = AnnotatedTextEdit.del(range, id);
|
|
532
|
-
}
|
|
533
|
-
this.edits.push(edit);
|
|
534
|
-
if (id !== void 0) {
|
|
535
|
-
return id;
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
TextEditChangeImpl2.prototype.add = function(edit) {
|
|
539
|
-
this.edits.push(edit);
|
|
540
|
-
};
|
|
541
|
-
TextEditChangeImpl2.prototype.all = function() {
|
|
542
|
-
return this.edits;
|
|
543
|
-
};
|
|
544
|
-
TextEditChangeImpl2.prototype.clear = function() {
|
|
545
|
-
this.edits.splice(0, this.edits.length);
|
|
546
|
-
};
|
|
547
|
-
TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) {
|
|
548
|
-
if (value === void 0) {
|
|
549
|
-
throw new Error("Text edit change is not configured to manage change annotations.");
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
return TextEditChangeImpl2;
|
|
553
|
-
}()
|
|
554
|
-
);
|
|
555
|
-
var ChangeAnnotations = (
|
|
556
|
-
/** @class */
|
|
557
|
-
function() {
|
|
558
|
-
function ChangeAnnotations2(annotations) {
|
|
559
|
-
this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations;
|
|
560
|
-
this._counter = 0;
|
|
561
|
-
this._size = 0;
|
|
562
|
-
}
|
|
563
|
-
ChangeAnnotations2.prototype.all = function() {
|
|
564
|
-
return this._annotations;
|
|
565
|
-
};
|
|
566
|
-
Object.defineProperty(ChangeAnnotations2.prototype, "size", {
|
|
567
|
-
get: function() {
|
|
568
|
-
return this._size;
|
|
569
|
-
},
|
|
570
|
-
enumerable: false,
|
|
571
|
-
configurable: true
|
|
572
|
-
});
|
|
573
|
-
ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) {
|
|
574
|
-
var id;
|
|
575
|
-
if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
|
|
576
|
-
id = idOrAnnotation;
|
|
577
|
-
} else {
|
|
578
|
-
id = this.nextId();
|
|
579
|
-
annotation = idOrAnnotation;
|
|
580
|
-
}
|
|
581
|
-
if (this._annotations[id] !== void 0) {
|
|
582
|
-
throw new Error("Id ".concat(id, " is already in use."));
|
|
583
|
-
}
|
|
584
|
-
if (annotation === void 0) {
|
|
585
|
-
throw new Error("No annotation provided for id ".concat(id));
|
|
586
|
-
}
|
|
587
|
-
this._annotations[id] = annotation;
|
|
588
|
-
this._size++;
|
|
589
|
-
return id;
|
|
590
|
-
};
|
|
591
|
-
ChangeAnnotations2.prototype.nextId = function() {
|
|
592
|
-
this._counter++;
|
|
593
|
-
return this._counter.toString();
|
|
594
|
-
};
|
|
595
|
-
return ChangeAnnotations2;
|
|
596
|
-
}()
|
|
597
|
-
);
|
|
598
|
-
(
|
|
599
|
-
/** @class */
|
|
600
|
-
(function() {
|
|
601
|
-
function WorkspaceChange2(workspaceEdit) {
|
|
602
|
-
var _this = this;
|
|
603
|
-
this._textEditChanges = /* @__PURE__ */ Object.create(null);
|
|
604
|
-
if (workspaceEdit !== void 0) {
|
|
605
|
-
this._workspaceEdit = workspaceEdit;
|
|
606
|
-
if (workspaceEdit.documentChanges) {
|
|
607
|
-
this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
|
|
608
|
-
workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
609
|
-
workspaceEdit.documentChanges.forEach(function(change) {
|
|
610
|
-
if (TextDocumentEdit.is(change)) {
|
|
611
|
-
var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
|
|
612
|
-
_this._textEditChanges[change.textDocument.uri] = textEditChange;
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
} else if (workspaceEdit.changes) {
|
|
616
|
-
Object.keys(workspaceEdit.changes).forEach(function(key) {
|
|
617
|
-
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
|
|
618
|
-
_this._textEditChanges[key] = textEditChange;
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
} else {
|
|
622
|
-
this._workspaceEdit = {};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
Object.defineProperty(WorkspaceChange2.prototype, "edit", {
|
|
626
|
-
/**
|
|
627
|
-
* Returns the underlying {@link WorkspaceEdit} literal
|
|
628
|
-
* use to be returned from a workspace edit operation like rename.
|
|
629
|
-
*/
|
|
630
|
-
get: function() {
|
|
631
|
-
this.initDocumentChanges();
|
|
632
|
-
if (this._changeAnnotations !== void 0) {
|
|
633
|
-
if (this._changeAnnotations.size === 0) {
|
|
634
|
-
this._workspaceEdit.changeAnnotations = void 0;
|
|
635
|
-
} else {
|
|
636
|
-
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
return this._workspaceEdit;
|
|
640
|
-
},
|
|
641
|
-
enumerable: false,
|
|
642
|
-
configurable: true
|
|
643
|
-
});
|
|
644
|
-
WorkspaceChange2.prototype.getTextEditChange = function(key) {
|
|
645
|
-
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
|
|
646
|
-
this.initDocumentChanges();
|
|
647
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
648
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
649
|
-
}
|
|
650
|
-
var textDocument = { uri: key.uri, version: key.version };
|
|
651
|
-
var result = this._textEditChanges[textDocument.uri];
|
|
652
|
-
if (!result) {
|
|
653
|
-
var edits = [];
|
|
654
|
-
var textDocumentEdit = {
|
|
655
|
-
textDocument,
|
|
656
|
-
edits
|
|
657
|
-
};
|
|
658
|
-
this._workspaceEdit.documentChanges.push(textDocumentEdit);
|
|
659
|
-
result = new TextEditChangeImpl(edits, this._changeAnnotations);
|
|
660
|
-
this._textEditChanges[textDocument.uri] = result;
|
|
661
|
-
}
|
|
662
|
-
return result;
|
|
663
|
-
} else {
|
|
664
|
-
this.initChanges();
|
|
665
|
-
if (this._workspaceEdit.changes === void 0) {
|
|
666
|
-
throw new Error("Workspace edit is not configured for normal text edit changes.");
|
|
667
|
-
}
|
|
668
|
-
var result = this._textEditChanges[key];
|
|
669
|
-
if (!result) {
|
|
670
|
-
var edits = [];
|
|
671
|
-
this._workspaceEdit.changes[key] = edits;
|
|
672
|
-
result = new TextEditChangeImpl(edits);
|
|
673
|
-
this._textEditChanges[key] = result;
|
|
674
|
-
}
|
|
675
|
-
return result;
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
WorkspaceChange2.prototype.initDocumentChanges = function() {
|
|
679
|
-
if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
|
|
680
|
-
this._changeAnnotations = new ChangeAnnotations();
|
|
681
|
-
this._workspaceEdit.documentChanges = [];
|
|
682
|
-
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
WorkspaceChange2.prototype.initChanges = function() {
|
|
686
|
-
if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
|
|
687
|
-
this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null);
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
|
|
691
|
-
this.initDocumentChanges();
|
|
692
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
693
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
694
|
-
}
|
|
695
|
-
var annotation;
|
|
696
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
697
|
-
annotation = optionsOrAnnotation;
|
|
698
|
-
} else {
|
|
699
|
-
options = optionsOrAnnotation;
|
|
700
|
-
}
|
|
701
|
-
var operation;
|
|
702
|
-
var id;
|
|
703
|
-
if (annotation === void 0) {
|
|
704
|
-
operation = CreateFile.create(uri, options);
|
|
705
|
-
} else {
|
|
706
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
707
|
-
operation = CreateFile.create(uri, options, id);
|
|
708
|
-
}
|
|
709
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
710
|
-
if (id !== void 0) {
|
|
711
|
-
return id;
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) {
|
|
715
|
-
this.initDocumentChanges();
|
|
716
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
717
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
718
|
-
}
|
|
719
|
-
var annotation;
|
|
720
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
721
|
-
annotation = optionsOrAnnotation;
|
|
722
|
-
} else {
|
|
723
|
-
options = optionsOrAnnotation;
|
|
724
|
-
}
|
|
725
|
-
var operation;
|
|
726
|
-
var id;
|
|
727
|
-
if (annotation === void 0) {
|
|
728
|
-
operation = RenameFile.create(oldUri, newUri, options);
|
|
729
|
-
} else {
|
|
730
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
731
|
-
operation = RenameFile.create(oldUri, newUri, options, id);
|
|
732
|
-
}
|
|
733
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
734
|
-
if (id !== void 0) {
|
|
735
|
-
return id;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) {
|
|
739
|
-
this.initDocumentChanges();
|
|
740
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
741
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
742
|
-
}
|
|
743
|
-
var annotation;
|
|
744
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
745
|
-
annotation = optionsOrAnnotation;
|
|
746
|
-
} else {
|
|
747
|
-
options = optionsOrAnnotation;
|
|
748
|
-
}
|
|
749
|
-
var operation;
|
|
750
|
-
var id;
|
|
751
|
-
if (annotation === void 0) {
|
|
752
|
-
operation = DeleteFile.create(uri, options);
|
|
753
|
-
} else {
|
|
754
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
755
|
-
operation = DeleteFile.create(uri, options, id);
|
|
756
|
-
}
|
|
757
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
758
|
-
if (id !== void 0) {
|
|
759
|
-
return id;
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
return WorkspaceChange2;
|
|
763
|
-
})()
|
|
764
|
-
);
|
|
765
|
-
var TextDocumentIdentifier;
|
|
766
|
-
(function(TextDocumentIdentifier2) {
|
|
767
|
-
function create(uri) {
|
|
768
|
-
return { uri };
|
|
769
|
-
}
|
|
770
|
-
TextDocumentIdentifier2.create = create;
|
|
771
|
-
function is(value) {
|
|
772
|
-
var candidate = value;
|
|
773
|
-
return Is.defined(candidate) && Is.string(candidate.uri);
|
|
774
|
-
}
|
|
775
|
-
TextDocumentIdentifier2.is = is;
|
|
776
|
-
})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
|
|
777
|
-
var VersionedTextDocumentIdentifier;
|
|
778
|
-
(function(VersionedTextDocumentIdentifier2) {
|
|
779
|
-
function create(uri, version) {
|
|
780
|
-
return { uri, version };
|
|
781
|
-
}
|
|
782
|
-
VersionedTextDocumentIdentifier2.create = create;
|
|
783
|
-
function is(value) {
|
|
784
|
-
var candidate = value;
|
|
785
|
-
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
|
|
786
|
-
}
|
|
787
|
-
VersionedTextDocumentIdentifier2.is = is;
|
|
788
|
-
})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
|
|
789
|
-
var OptionalVersionedTextDocumentIdentifier;
|
|
790
|
-
(function(OptionalVersionedTextDocumentIdentifier2) {
|
|
791
|
-
function create(uri, version) {
|
|
792
|
-
return { uri, version };
|
|
793
|
-
}
|
|
794
|
-
OptionalVersionedTextDocumentIdentifier2.create = create;
|
|
795
|
-
function is(value) {
|
|
796
|
-
var candidate = value;
|
|
797
|
-
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
|
|
798
|
-
}
|
|
799
|
-
OptionalVersionedTextDocumentIdentifier2.is = is;
|
|
800
|
-
})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
|
|
801
|
-
var TextDocumentItem;
|
|
802
|
-
(function(TextDocumentItem2) {
|
|
803
|
-
function create(uri, languageId, version, text) {
|
|
804
|
-
return { uri, languageId, version, text };
|
|
805
|
-
}
|
|
806
|
-
TextDocumentItem2.create = create;
|
|
807
|
-
function is(value) {
|
|
808
|
-
var candidate = value;
|
|
809
|
-
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
|
|
810
|
-
}
|
|
811
|
-
TextDocumentItem2.is = is;
|
|
812
|
-
})(TextDocumentItem || (TextDocumentItem = {}));
|
|
813
|
-
var MarkupKind;
|
|
814
|
-
(function(MarkupKind2) {
|
|
815
|
-
MarkupKind2.PlainText = "plaintext";
|
|
816
|
-
MarkupKind2.Markdown = "markdown";
|
|
817
|
-
function is(value) {
|
|
818
|
-
var candidate = value;
|
|
819
|
-
return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
|
|
820
|
-
}
|
|
821
|
-
MarkupKind2.is = is;
|
|
822
|
-
})(MarkupKind || (MarkupKind = {}));
|
|
823
|
-
var MarkupContent;
|
|
824
|
-
(function(MarkupContent2) {
|
|
825
|
-
function is(value) {
|
|
826
|
-
var candidate = value;
|
|
827
|
-
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
|
|
828
|
-
}
|
|
829
|
-
MarkupContent2.is = is;
|
|
830
|
-
})(MarkupContent || (MarkupContent = {}));
|
|
831
|
-
var CompletionItemKind;
|
|
832
|
-
(function(CompletionItemKind2) {
|
|
833
|
-
CompletionItemKind2.Text = 1;
|
|
834
|
-
CompletionItemKind2.Method = 2;
|
|
835
|
-
CompletionItemKind2.Function = 3;
|
|
836
|
-
CompletionItemKind2.Constructor = 4;
|
|
837
|
-
CompletionItemKind2.Field = 5;
|
|
838
|
-
CompletionItemKind2.Variable = 6;
|
|
839
|
-
CompletionItemKind2.Class = 7;
|
|
840
|
-
CompletionItemKind2.Interface = 8;
|
|
841
|
-
CompletionItemKind2.Module = 9;
|
|
842
|
-
CompletionItemKind2.Property = 10;
|
|
843
|
-
CompletionItemKind2.Unit = 11;
|
|
844
|
-
CompletionItemKind2.Value = 12;
|
|
845
|
-
CompletionItemKind2.Enum = 13;
|
|
846
|
-
CompletionItemKind2.Keyword = 14;
|
|
847
|
-
CompletionItemKind2.Snippet = 15;
|
|
848
|
-
CompletionItemKind2.Color = 16;
|
|
849
|
-
CompletionItemKind2.File = 17;
|
|
850
|
-
CompletionItemKind2.Reference = 18;
|
|
851
|
-
CompletionItemKind2.Folder = 19;
|
|
852
|
-
CompletionItemKind2.EnumMember = 20;
|
|
853
|
-
CompletionItemKind2.Constant = 21;
|
|
854
|
-
CompletionItemKind2.Struct = 22;
|
|
855
|
-
CompletionItemKind2.Event = 23;
|
|
856
|
-
CompletionItemKind2.Operator = 24;
|
|
857
|
-
CompletionItemKind2.TypeParameter = 25;
|
|
858
|
-
})(CompletionItemKind || (CompletionItemKind = {}));
|
|
859
|
-
var InsertTextFormat;
|
|
860
|
-
(function(InsertTextFormat2) {
|
|
861
|
-
InsertTextFormat2.PlainText = 1;
|
|
862
|
-
InsertTextFormat2.Snippet = 2;
|
|
863
|
-
})(InsertTextFormat || (InsertTextFormat = {}));
|
|
864
|
-
var CompletionItemTag;
|
|
865
|
-
(function(CompletionItemTag2) {
|
|
866
|
-
CompletionItemTag2.Deprecated = 1;
|
|
867
|
-
})(CompletionItemTag || (CompletionItemTag = {}));
|
|
868
|
-
var InsertReplaceEdit;
|
|
869
|
-
(function(InsertReplaceEdit2) {
|
|
870
|
-
function create(newText, insert, replace) {
|
|
871
|
-
return { newText, insert, replace };
|
|
872
|
-
}
|
|
873
|
-
InsertReplaceEdit2.create = create;
|
|
874
|
-
function is(value) {
|
|
875
|
-
var candidate = value;
|
|
876
|
-
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
|
|
877
|
-
}
|
|
878
|
-
InsertReplaceEdit2.is = is;
|
|
879
|
-
})(InsertReplaceEdit || (InsertReplaceEdit = {}));
|
|
880
|
-
var InsertTextMode;
|
|
881
|
-
(function(InsertTextMode2) {
|
|
882
|
-
InsertTextMode2.asIs = 1;
|
|
883
|
-
InsertTextMode2.adjustIndentation = 2;
|
|
884
|
-
})(InsertTextMode || (InsertTextMode = {}));
|
|
885
|
-
var CompletionItemLabelDetails;
|
|
886
|
-
(function(CompletionItemLabelDetails2) {
|
|
887
|
-
function is(value) {
|
|
888
|
-
var candidate = value;
|
|
889
|
-
return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
|
|
890
|
-
}
|
|
891
|
-
CompletionItemLabelDetails2.is = is;
|
|
892
|
-
})(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
|
|
893
|
-
var CompletionItem;
|
|
894
|
-
(function(CompletionItem6) {
|
|
895
|
-
function create(label) {
|
|
896
|
-
return { label };
|
|
897
|
-
}
|
|
898
|
-
CompletionItem6.create = create;
|
|
899
|
-
})(CompletionItem || (CompletionItem = {}));
|
|
900
|
-
var CompletionList;
|
|
901
|
-
(function(CompletionList3) {
|
|
902
|
-
function create(items, isIncomplete) {
|
|
903
|
-
return { items: items ? items : [], isIncomplete: !!isIncomplete };
|
|
904
|
-
}
|
|
905
|
-
CompletionList3.create = create;
|
|
906
|
-
})(CompletionList || (CompletionList = {}));
|
|
907
|
-
var MarkedString;
|
|
908
|
-
(function(MarkedString2) {
|
|
909
|
-
function fromPlainText(plainText) {
|
|
910
|
-
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
|
|
911
|
-
}
|
|
912
|
-
MarkedString2.fromPlainText = fromPlainText;
|
|
913
|
-
function is(value) {
|
|
914
|
-
var candidate = value;
|
|
915
|
-
return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
|
|
916
|
-
}
|
|
917
|
-
MarkedString2.is = is;
|
|
918
|
-
})(MarkedString || (MarkedString = {}));
|
|
919
|
-
var Hover;
|
|
920
|
-
(function(Hover2) {
|
|
921
|
-
function is(value) {
|
|
922
|
-
var candidate = value;
|
|
923
|
-
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
|
|
924
|
-
}
|
|
925
|
-
Hover2.is = is;
|
|
926
|
-
})(Hover || (Hover = {}));
|
|
927
|
-
var ParameterInformation;
|
|
928
|
-
(function(ParameterInformation2) {
|
|
929
|
-
function create(label, documentation) {
|
|
930
|
-
return documentation ? { label, documentation } : { label };
|
|
931
|
-
}
|
|
932
|
-
ParameterInformation2.create = create;
|
|
933
|
-
})(ParameterInformation || (ParameterInformation = {}));
|
|
934
|
-
var SignatureInformation;
|
|
935
|
-
(function(SignatureInformation2) {
|
|
936
|
-
function create(label, documentation) {
|
|
937
|
-
var parameters = [];
|
|
938
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
939
|
-
parameters[_i - 2] = arguments[_i];
|
|
940
|
-
}
|
|
941
|
-
var result = { label };
|
|
942
|
-
if (Is.defined(documentation)) {
|
|
943
|
-
result.documentation = documentation;
|
|
944
|
-
}
|
|
945
|
-
if (Is.defined(parameters)) {
|
|
946
|
-
result.parameters = parameters;
|
|
947
|
-
} else {
|
|
948
|
-
result.parameters = [];
|
|
949
|
-
}
|
|
950
|
-
return result;
|
|
951
|
-
}
|
|
952
|
-
SignatureInformation2.create = create;
|
|
953
|
-
})(SignatureInformation || (SignatureInformation = {}));
|
|
954
|
-
var DocumentHighlightKind;
|
|
955
|
-
(function(DocumentHighlightKind2) {
|
|
956
|
-
DocumentHighlightKind2.Text = 1;
|
|
957
|
-
DocumentHighlightKind2.Read = 2;
|
|
958
|
-
DocumentHighlightKind2.Write = 3;
|
|
959
|
-
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
|
|
960
|
-
var DocumentHighlight;
|
|
961
|
-
(function(DocumentHighlight2) {
|
|
962
|
-
function create(range, kind) {
|
|
963
|
-
var result = { range };
|
|
964
|
-
if (Is.number(kind)) {
|
|
965
|
-
result.kind = kind;
|
|
966
|
-
}
|
|
967
|
-
return result;
|
|
968
|
-
}
|
|
969
|
-
DocumentHighlight2.create = create;
|
|
970
|
-
})(DocumentHighlight || (DocumentHighlight = {}));
|
|
971
|
-
var SymbolKind;
|
|
972
|
-
(function(SymbolKind2) {
|
|
973
|
-
SymbolKind2.File = 1;
|
|
974
|
-
SymbolKind2.Module = 2;
|
|
975
|
-
SymbolKind2.Namespace = 3;
|
|
976
|
-
SymbolKind2.Package = 4;
|
|
977
|
-
SymbolKind2.Class = 5;
|
|
978
|
-
SymbolKind2.Method = 6;
|
|
979
|
-
SymbolKind2.Property = 7;
|
|
980
|
-
SymbolKind2.Field = 8;
|
|
981
|
-
SymbolKind2.Constructor = 9;
|
|
982
|
-
SymbolKind2.Enum = 10;
|
|
983
|
-
SymbolKind2.Interface = 11;
|
|
984
|
-
SymbolKind2.Function = 12;
|
|
985
|
-
SymbolKind2.Variable = 13;
|
|
986
|
-
SymbolKind2.Constant = 14;
|
|
987
|
-
SymbolKind2.String = 15;
|
|
988
|
-
SymbolKind2.Number = 16;
|
|
989
|
-
SymbolKind2.Boolean = 17;
|
|
990
|
-
SymbolKind2.Array = 18;
|
|
991
|
-
SymbolKind2.Object = 19;
|
|
992
|
-
SymbolKind2.Key = 20;
|
|
993
|
-
SymbolKind2.Null = 21;
|
|
994
|
-
SymbolKind2.EnumMember = 22;
|
|
995
|
-
SymbolKind2.Struct = 23;
|
|
996
|
-
SymbolKind2.Event = 24;
|
|
997
|
-
SymbolKind2.Operator = 25;
|
|
998
|
-
SymbolKind2.TypeParameter = 26;
|
|
999
|
-
})(SymbolKind || (SymbolKind = {}));
|
|
1000
|
-
var SymbolTag;
|
|
1001
|
-
(function(SymbolTag2) {
|
|
1002
|
-
SymbolTag2.Deprecated = 1;
|
|
1003
|
-
})(SymbolTag || (SymbolTag = {}));
|
|
1004
|
-
var SymbolInformation;
|
|
1005
|
-
(function(SymbolInformation2) {
|
|
1006
|
-
function create(name, kind, range, uri, containerName) {
|
|
1007
|
-
var result = {
|
|
1008
|
-
name,
|
|
1009
|
-
kind,
|
|
1010
|
-
location: { uri, range }
|
|
1011
|
-
};
|
|
1012
|
-
if (containerName) {
|
|
1013
|
-
result.containerName = containerName;
|
|
1014
|
-
}
|
|
1015
|
-
return result;
|
|
1016
|
-
}
|
|
1017
|
-
SymbolInformation2.create = create;
|
|
1018
|
-
})(SymbolInformation || (SymbolInformation = {}));
|
|
1019
|
-
var WorkspaceSymbol;
|
|
1020
|
-
(function(WorkspaceSymbol2) {
|
|
1021
|
-
function create(name, kind, uri, range) {
|
|
1022
|
-
return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } };
|
|
1023
|
-
}
|
|
1024
|
-
WorkspaceSymbol2.create = create;
|
|
1025
|
-
})(WorkspaceSymbol || (WorkspaceSymbol = {}));
|
|
1026
|
-
var DocumentSymbol;
|
|
1027
|
-
(function(DocumentSymbol2) {
|
|
1028
|
-
function create(name, detail, kind, range, selectionRange, children) {
|
|
1029
|
-
var result = {
|
|
1030
|
-
name,
|
|
1031
|
-
detail,
|
|
1032
|
-
kind,
|
|
1033
|
-
range,
|
|
1034
|
-
selectionRange
|
|
1035
|
-
};
|
|
1036
|
-
if (children !== void 0) {
|
|
1037
|
-
result.children = children;
|
|
1038
|
-
}
|
|
1039
|
-
return result;
|
|
1040
|
-
}
|
|
1041
|
-
DocumentSymbol2.create = create;
|
|
1042
|
-
function is(value) {
|
|
1043
|
-
var candidate = value;
|
|
1044
|
-
return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
|
|
1045
|
-
}
|
|
1046
|
-
DocumentSymbol2.is = is;
|
|
1047
|
-
})(DocumentSymbol || (DocumentSymbol = {}));
|
|
1048
|
-
var CodeActionKind;
|
|
1049
|
-
(function(CodeActionKind2) {
|
|
1050
|
-
CodeActionKind2.Empty = "";
|
|
1051
|
-
CodeActionKind2.QuickFix = "quickfix";
|
|
1052
|
-
CodeActionKind2.Refactor = "refactor";
|
|
1053
|
-
CodeActionKind2.RefactorExtract = "refactor.extract";
|
|
1054
|
-
CodeActionKind2.RefactorInline = "refactor.inline";
|
|
1055
|
-
CodeActionKind2.RefactorRewrite = "refactor.rewrite";
|
|
1056
|
-
CodeActionKind2.Source = "source";
|
|
1057
|
-
CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
|
|
1058
|
-
CodeActionKind2.SourceFixAll = "source.fixAll";
|
|
1059
|
-
})(CodeActionKind || (CodeActionKind = {}));
|
|
1060
|
-
var CodeActionTriggerKind;
|
|
1061
|
-
(function(CodeActionTriggerKind2) {
|
|
1062
|
-
CodeActionTriggerKind2.Invoked = 1;
|
|
1063
|
-
CodeActionTriggerKind2.Automatic = 2;
|
|
1064
|
-
})(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
|
|
1065
|
-
var CodeActionContext;
|
|
1066
|
-
(function(CodeActionContext2) {
|
|
1067
|
-
function create(diagnostics, only, triggerKind) {
|
|
1068
|
-
var result = { diagnostics };
|
|
1069
|
-
if (only !== void 0 && only !== null) {
|
|
1070
|
-
result.only = only;
|
|
1071
|
-
}
|
|
1072
|
-
if (triggerKind !== void 0 && triggerKind !== null) {
|
|
1073
|
-
result.triggerKind = triggerKind;
|
|
1074
|
-
}
|
|
1075
|
-
return result;
|
|
1076
|
-
}
|
|
1077
|
-
CodeActionContext2.create = create;
|
|
1078
|
-
function is(value) {
|
|
1079
|
-
var candidate = value;
|
|
1080
|
-
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic2.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
|
|
1081
|
-
}
|
|
1082
|
-
CodeActionContext2.is = is;
|
|
1083
|
-
})(CodeActionContext || (CodeActionContext = {}));
|
|
1084
|
-
var CodeAction;
|
|
1085
|
-
(function(CodeAction2) {
|
|
1086
|
-
function create(title, kindOrCommandOrEdit, kind) {
|
|
1087
|
-
var result = { title };
|
|
1088
|
-
var checkKind = true;
|
|
1089
|
-
if (typeof kindOrCommandOrEdit === "string") {
|
|
1090
|
-
checkKind = false;
|
|
1091
|
-
result.kind = kindOrCommandOrEdit;
|
|
1092
|
-
} else if (Command.is(kindOrCommandOrEdit)) {
|
|
1093
|
-
result.command = kindOrCommandOrEdit;
|
|
1094
|
-
} else {
|
|
1095
|
-
result.edit = kindOrCommandOrEdit;
|
|
1096
|
-
}
|
|
1097
|
-
if (checkKind && kind !== void 0) {
|
|
1098
|
-
result.kind = kind;
|
|
1099
|
-
}
|
|
1100
|
-
return result;
|
|
1101
|
-
}
|
|
1102
|
-
CodeAction2.create = create;
|
|
1103
|
-
function is(value) {
|
|
1104
|
-
var candidate = value;
|
|
1105
|
-
return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic2.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
|
|
1106
|
-
}
|
|
1107
|
-
CodeAction2.is = is;
|
|
1108
|
-
})(CodeAction || (CodeAction = {}));
|
|
1109
|
-
var CodeLens;
|
|
1110
|
-
(function(CodeLens2) {
|
|
1111
|
-
function create(range, data) {
|
|
1112
|
-
var result = { range };
|
|
1113
|
-
if (Is.defined(data)) {
|
|
1114
|
-
result.data = data;
|
|
1115
|
-
}
|
|
1116
|
-
return result;
|
|
1117
|
-
}
|
|
1118
|
-
CodeLens2.create = create;
|
|
1119
|
-
function is(value) {
|
|
1120
|
-
var candidate = value;
|
|
1121
|
-
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
|
|
1122
|
-
}
|
|
1123
|
-
CodeLens2.is = is;
|
|
1124
|
-
})(CodeLens || (CodeLens = {}));
|
|
1125
|
-
var FormattingOptions;
|
|
1126
|
-
(function(FormattingOptions5) {
|
|
1127
|
-
function create(tabSize, insertSpaces) {
|
|
1128
|
-
return { tabSize, insertSpaces };
|
|
1129
|
-
}
|
|
1130
|
-
FormattingOptions5.create = create;
|
|
1131
|
-
function is(value) {
|
|
1132
|
-
var candidate = value;
|
|
1133
|
-
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
|
|
1134
|
-
}
|
|
1135
|
-
FormattingOptions5.is = is;
|
|
1136
|
-
})(FormattingOptions || (FormattingOptions = {}));
|
|
1137
|
-
var DocumentLink;
|
|
1138
|
-
(function(DocumentLink2) {
|
|
1139
|
-
function create(range, target, data) {
|
|
1140
|
-
return { range, target, data };
|
|
1141
|
-
}
|
|
1142
|
-
DocumentLink2.create = create;
|
|
1143
|
-
function is(value) {
|
|
1144
|
-
var candidate = value;
|
|
1145
|
-
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
|
|
1146
|
-
}
|
|
1147
|
-
DocumentLink2.is = is;
|
|
1148
|
-
})(DocumentLink || (DocumentLink = {}));
|
|
1149
|
-
var SelectionRange;
|
|
1150
|
-
(function(SelectionRange2) {
|
|
1151
|
-
function create(range, parent) {
|
|
1152
|
-
return { range, parent };
|
|
1153
|
-
}
|
|
1154
|
-
SelectionRange2.create = create;
|
|
1155
|
-
function is(value) {
|
|
1156
|
-
var candidate = value;
|
|
1157
|
-
return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
|
|
1158
|
-
}
|
|
1159
|
-
SelectionRange2.is = is;
|
|
1160
|
-
})(SelectionRange || (SelectionRange = {}));
|
|
1161
|
-
var SemanticTokenTypes;
|
|
1162
|
-
(function(SemanticTokenTypes2) {
|
|
1163
|
-
SemanticTokenTypes2["namespace"] = "namespace";
|
|
1164
|
-
SemanticTokenTypes2["type"] = "type";
|
|
1165
|
-
SemanticTokenTypes2["class"] = "class";
|
|
1166
|
-
SemanticTokenTypes2["enum"] = "enum";
|
|
1167
|
-
SemanticTokenTypes2["interface"] = "interface";
|
|
1168
|
-
SemanticTokenTypes2["struct"] = "struct";
|
|
1169
|
-
SemanticTokenTypes2["typeParameter"] = "typeParameter";
|
|
1170
|
-
SemanticTokenTypes2["parameter"] = "parameter";
|
|
1171
|
-
SemanticTokenTypes2["variable"] = "variable";
|
|
1172
|
-
SemanticTokenTypes2["property"] = "property";
|
|
1173
|
-
SemanticTokenTypes2["enumMember"] = "enumMember";
|
|
1174
|
-
SemanticTokenTypes2["event"] = "event";
|
|
1175
|
-
SemanticTokenTypes2["function"] = "function";
|
|
1176
|
-
SemanticTokenTypes2["method"] = "method";
|
|
1177
|
-
SemanticTokenTypes2["macro"] = "macro";
|
|
1178
|
-
SemanticTokenTypes2["keyword"] = "keyword";
|
|
1179
|
-
SemanticTokenTypes2["modifier"] = "modifier";
|
|
1180
|
-
SemanticTokenTypes2["comment"] = "comment";
|
|
1181
|
-
SemanticTokenTypes2["string"] = "string";
|
|
1182
|
-
SemanticTokenTypes2["number"] = "number";
|
|
1183
|
-
SemanticTokenTypes2["regexp"] = "regexp";
|
|
1184
|
-
SemanticTokenTypes2["operator"] = "operator";
|
|
1185
|
-
SemanticTokenTypes2["decorator"] = "decorator";
|
|
1186
|
-
})(SemanticTokenTypes || (SemanticTokenTypes = {}));
|
|
1187
|
-
var SemanticTokenModifiers;
|
|
1188
|
-
(function(SemanticTokenModifiers2) {
|
|
1189
|
-
SemanticTokenModifiers2["declaration"] = "declaration";
|
|
1190
|
-
SemanticTokenModifiers2["definition"] = "definition";
|
|
1191
|
-
SemanticTokenModifiers2["readonly"] = "readonly";
|
|
1192
|
-
SemanticTokenModifiers2["static"] = "static";
|
|
1193
|
-
SemanticTokenModifiers2["deprecated"] = "deprecated";
|
|
1194
|
-
SemanticTokenModifiers2["abstract"] = "abstract";
|
|
1195
|
-
SemanticTokenModifiers2["async"] = "async";
|
|
1196
|
-
SemanticTokenModifiers2["modification"] = "modification";
|
|
1197
|
-
SemanticTokenModifiers2["documentation"] = "documentation";
|
|
1198
|
-
SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
|
|
1199
|
-
})(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
|
|
1200
|
-
var SemanticTokens;
|
|
1201
|
-
(function(SemanticTokens2) {
|
|
1202
|
-
function is(value) {
|
|
1203
|
-
var candidate = value;
|
|
1204
|
-
return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number");
|
|
1205
|
-
}
|
|
1206
|
-
SemanticTokens2.is = is;
|
|
1207
|
-
})(SemanticTokens || (SemanticTokens = {}));
|
|
1208
|
-
var InlineValueText;
|
|
1209
|
-
(function(InlineValueText2) {
|
|
1210
|
-
function create(range, text) {
|
|
1211
|
-
return { range, text };
|
|
1212
|
-
}
|
|
1213
|
-
InlineValueText2.create = create;
|
|
1214
|
-
function is(value) {
|
|
1215
|
-
var candidate = value;
|
|
1216
|
-
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
|
|
1217
|
-
}
|
|
1218
|
-
InlineValueText2.is = is;
|
|
1219
|
-
})(InlineValueText || (InlineValueText = {}));
|
|
1220
|
-
var InlineValueVariableLookup;
|
|
1221
|
-
(function(InlineValueVariableLookup2) {
|
|
1222
|
-
function create(range, variableName, caseSensitiveLookup) {
|
|
1223
|
-
return { range, variableName, caseSensitiveLookup };
|
|
1224
|
-
}
|
|
1225
|
-
InlineValueVariableLookup2.create = create;
|
|
1226
|
-
function is(value) {
|
|
1227
|
-
var candidate = value;
|
|
1228
|
-
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
|
|
1229
|
-
}
|
|
1230
|
-
InlineValueVariableLookup2.is = is;
|
|
1231
|
-
})(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
|
|
1232
|
-
var InlineValueEvaluatableExpression;
|
|
1233
|
-
(function(InlineValueEvaluatableExpression2) {
|
|
1234
|
-
function create(range, expression) {
|
|
1235
|
-
return { range, expression };
|
|
1236
|
-
}
|
|
1237
|
-
InlineValueEvaluatableExpression2.create = create;
|
|
1238
|
-
function is(value) {
|
|
1239
|
-
var candidate = value;
|
|
1240
|
-
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
|
|
1241
|
-
}
|
|
1242
|
-
InlineValueEvaluatableExpression2.is = is;
|
|
1243
|
-
})(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
|
|
1244
|
-
var InlineValueContext;
|
|
1245
|
-
(function(InlineValueContext2) {
|
|
1246
|
-
function create(frameId, stoppedLocation) {
|
|
1247
|
-
return { frameId, stoppedLocation };
|
|
1248
|
-
}
|
|
1249
|
-
InlineValueContext2.create = create;
|
|
1250
|
-
function is(value) {
|
|
1251
|
-
var candidate = value;
|
|
1252
|
-
return Is.defined(candidate) && Range.is(value.stoppedLocation);
|
|
1253
|
-
}
|
|
1254
|
-
InlineValueContext2.is = is;
|
|
1255
|
-
})(InlineValueContext || (InlineValueContext = {}));
|
|
1256
|
-
var InlayHintKind;
|
|
1257
|
-
(function(InlayHintKind2) {
|
|
1258
|
-
InlayHintKind2.Type = 1;
|
|
1259
|
-
InlayHintKind2.Parameter = 2;
|
|
1260
|
-
function is(value) {
|
|
1261
|
-
return value === 1 || value === 2;
|
|
1262
|
-
}
|
|
1263
|
-
InlayHintKind2.is = is;
|
|
1264
|
-
})(InlayHintKind || (InlayHintKind = {}));
|
|
1265
|
-
var InlayHintLabelPart;
|
|
1266
|
-
(function(InlayHintLabelPart2) {
|
|
1267
|
-
function create(value) {
|
|
1268
|
-
return { value };
|
|
1269
|
-
}
|
|
1270
|
-
InlayHintLabelPart2.create = create;
|
|
1271
|
-
function is(value) {
|
|
1272
|
-
var candidate = value;
|
|
1273
|
-
return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command));
|
|
1274
|
-
}
|
|
1275
|
-
InlayHintLabelPart2.is = is;
|
|
1276
|
-
})(InlayHintLabelPart || (InlayHintLabelPart = {}));
|
|
1277
|
-
var InlayHint;
|
|
1278
|
-
(function(InlayHint2) {
|
|
1279
|
-
function create(position, label, kind) {
|
|
1280
|
-
var result = { position, label };
|
|
1281
|
-
if (kind !== void 0) {
|
|
1282
|
-
result.kind = kind;
|
|
1283
|
-
}
|
|
1284
|
-
return result;
|
|
1285
|
-
}
|
|
1286
|
-
InlayHint2.create = create;
|
|
1287
|
-
function is(value) {
|
|
1288
|
-
var candidate = value;
|
|
1289
|
-
return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight));
|
|
1290
|
-
}
|
|
1291
|
-
InlayHint2.is = is;
|
|
1292
|
-
})(InlayHint || (InlayHint = {}));
|
|
1293
|
-
var WorkspaceFolder;
|
|
1294
|
-
(function(WorkspaceFolder2) {
|
|
1295
|
-
function is(value) {
|
|
1296
|
-
var candidate = value;
|
|
1297
|
-
return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
|
|
1298
|
-
}
|
|
1299
|
-
WorkspaceFolder2.is = is;
|
|
1300
|
-
})(WorkspaceFolder || (WorkspaceFolder = {}));
|
|
1301
|
-
var TextDocument;
|
|
1302
|
-
(function(TextDocument2) {
|
|
1303
|
-
function create(uri, languageId, version, content) {
|
|
1304
|
-
return new FullTextDocument(uri, languageId, version, content);
|
|
1305
|
-
}
|
|
1306
|
-
TextDocument2.create = create;
|
|
1307
|
-
function is(value) {
|
|
1308
|
-
var candidate = value;
|
|
1309
|
-
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
|
|
1310
|
-
}
|
|
1311
|
-
TextDocument2.is = is;
|
|
1312
|
-
function applyEdits(document, edits) {
|
|
1313
|
-
var text = document.getText();
|
|
1314
|
-
var sortedEdits = mergeSort(edits, function(a, b) {
|
|
1315
|
-
var diff = a.range.start.line - b.range.start.line;
|
|
1316
|
-
if (diff === 0) {
|
|
1317
|
-
return a.range.start.character - b.range.start.character;
|
|
1318
|
-
}
|
|
1319
|
-
return diff;
|
|
1320
|
-
});
|
|
1321
|
-
var lastModifiedOffset = text.length;
|
|
1322
|
-
for (var i = sortedEdits.length - 1; i >= 0; i--) {
|
|
1323
|
-
var e = sortedEdits[i];
|
|
1324
|
-
var startOffset = document.offsetAt(e.range.start);
|
|
1325
|
-
var endOffset = document.offsetAt(e.range.end);
|
|
1326
|
-
if (endOffset <= lastModifiedOffset) {
|
|
1327
|
-
text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
|
|
1328
|
-
} else {
|
|
1329
|
-
throw new Error("Overlapping edit");
|
|
1330
|
-
}
|
|
1331
|
-
lastModifiedOffset = startOffset;
|
|
1332
|
-
}
|
|
1333
|
-
return text;
|
|
1334
|
-
}
|
|
1335
|
-
TextDocument2.applyEdits = applyEdits;
|
|
1336
|
-
function mergeSort(data, compare) {
|
|
1337
|
-
if (data.length <= 1) {
|
|
1338
|
-
return data;
|
|
1339
|
-
}
|
|
1340
|
-
var p = data.length / 2 | 0;
|
|
1341
|
-
var left = data.slice(0, p);
|
|
1342
|
-
var right = data.slice(p);
|
|
1343
|
-
mergeSort(left, compare);
|
|
1344
|
-
mergeSort(right, compare);
|
|
1345
|
-
var leftIdx = 0;
|
|
1346
|
-
var rightIdx = 0;
|
|
1347
|
-
var i = 0;
|
|
1348
|
-
while (leftIdx < left.length && rightIdx < right.length) {
|
|
1349
|
-
var ret = compare(left[leftIdx], right[rightIdx]);
|
|
1350
|
-
if (ret <= 0) {
|
|
1351
|
-
data[i++] = left[leftIdx++];
|
|
1352
|
-
} else {
|
|
1353
|
-
data[i++] = right[rightIdx++];
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
while (leftIdx < left.length) {
|
|
1357
|
-
data[i++] = left[leftIdx++];
|
|
1358
|
-
}
|
|
1359
|
-
while (rightIdx < right.length) {
|
|
1360
|
-
data[i++] = right[rightIdx++];
|
|
1361
|
-
}
|
|
1362
|
-
return data;
|
|
1363
|
-
}
|
|
1364
|
-
})(TextDocument || (TextDocument = {}));
|
|
1365
|
-
var FullTextDocument = (
|
|
1366
|
-
/** @class */
|
|
1367
|
-
function() {
|
|
1368
|
-
function FullTextDocument2(uri, languageId, version, content) {
|
|
1369
|
-
this._uri = uri;
|
|
1370
|
-
this._languageId = languageId;
|
|
1371
|
-
this._version = version;
|
|
1372
|
-
this._content = content;
|
|
1373
|
-
this._lineOffsets = void 0;
|
|
1374
|
-
}
|
|
1375
|
-
Object.defineProperty(FullTextDocument2.prototype, "uri", {
|
|
1376
|
-
get: function() {
|
|
1377
|
-
return this._uri;
|
|
1378
|
-
},
|
|
1379
|
-
enumerable: false,
|
|
1380
|
-
configurable: true
|
|
1381
|
-
});
|
|
1382
|
-
Object.defineProperty(FullTextDocument2.prototype, "languageId", {
|
|
1383
|
-
get: function() {
|
|
1384
|
-
return this._languageId;
|
|
1385
|
-
},
|
|
1386
|
-
enumerable: false,
|
|
1387
|
-
configurable: true
|
|
1388
|
-
});
|
|
1389
|
-
Object.defineProperty(FullTextDocument2.prototype, "version", {
|
|
1390
|
-
get: function() {
|
|
1391
|
-
return this._version;
|
|
1392
|
-
},
|
|
1393
|
-
enumerable: false,
|
|
1394
|
-
configurable: true
|
|
1395
|
-
});
|
|
1396
|
-
FullTextDocument2.prototype.getText = function(range) {
|
|
1397
|
-
if (range) {
|
|
1398
|
-
var start = this.offsetAt(range.start);
|
|
1399
|
-
var end = this.offsetAt(range.end);
|
|
1400
|
-
return this._content.substring(start, end);
|
|
1401
|
-
}
|
|
1402
|
-
return this._content;
|
|
1403
|
-
};
|
|
1404
|
-
FullTextDocument2.prototype.update = function(event, version) {
|
|
1405
|
-
this._content = event.text;
|
|
1406
|
-
this._version = version;
|
|
1407
|
-
this._lineOffsets = void 0;
|
|
1408
|
-
};
|
|
1409
|
-
FullTextDocument2.prototype.getLineOffsets = function() {
|
|
1410
|
-
if (this._lineOffsets === void 0) {
|
|
1411
|
-
var lineOffsets = [];
|
|
1412
|
-
var text = this._content;
|
|
1413
|
-
var isLineStart = true;
|
|
1414
|
-
for (var i = 0; i < text.length; i++) {
|
|
1415
|
-
if (isLineStart) {
|
|
1416
|
-
lineOffsets.push(i);
|
|
1417
|
-
isLineStart = false;
|
|
1418
|
-
}
|
|
1419
|
-
var ch = text.charAt(i);
|
|
1420
|
-
isLineStart = ch === "\r" || ch === "\n";
|
|
1421
|
-
if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
|
|
1422
|
-
i++;
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
if (isLineStart && text.length > 0) {
|
|
1426
|
-
lineOffsets.push(text.length);
|
|
1427
|
-
}
|
|
1428
|
-
this._lineOffsets = lineOffsets;
|
|
1429
|
-
}
|
|
1430
|
-
return this._lineOffsets;
|
|
1431
|
-
};
|
|
1432
|
-
FullTextDocument2.prototype.positionAt = function(offset) {
|
|
1433
|
-
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
1434
|
-
var lineOffsets = this.getLineOffsets();
|
|
1435
|
-
var low = 0, high = lineOffsets.length;
|
|
1436
|
-
if (high === 0) {
|
|
1437
|
-
return Position.create(0, offset);
|
|
1438
|
-
}
|
|
1439
|
-
while (low < high) {
|
|
1440
|
-
var mid = Math.floor((low + high) / 2);
|
|
1441
|
-
if (lineOffsets[mid] > offset) {
|
|
1442
|
-
high = mid;
|
|
1443
|
-
} else {
|
|
1444
|
-
low = mid + 1;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
var line = low - 1;
|
|
1448
|
-
return Position.create(line, offset - lineOffsets[line]);
|
|
1449
|
-
};
|
|
1450
|
-
FullTextDocument2.prototype.offsetAt = function(position) {
|
|
1451
|
-
var lineOffsets = this.getLineOffsets();
|
|
1452
|
-
if (position.line >= lineOffsets.length) {
|
|
1453
|
-
return this._content.length;
|
|
1454
|
-
} else if (position.line < 0) {
|
|
1455
|
-
return 0;
|
|
1456
|
-
}
|
|
1457
|
-
var lineOffset = lineOffsets[position.line];
|
|
1458
|
-
var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
|
|
1459
|
-
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
|
1460
|
-
};
|
|
1461
|
-
Object.defineProperty(FullTextDocument2.prototype, "lineCount", {
|
|
1462
|
-
get: function() {
|
|
1463
|
-
return this.getLineOffsets().length;
|
|
1464
|
-
},
|
|
1465
|
-
enumerable: false,
|
|
1466
|
-
configurable: true
|
|
1467
|
-
});
|
|
1468
|
-
return FullTextDocument2;
|
|
1469
|
-
}()
|
|
1470
|
-
);
|
|
1471
|
-
var Is;
|
|
1472
|
-
(function(Is2) {
|
|
1473
|
-
var toString = Object.prototype.toString;
|
|
1474
|
-
function defined(value) {
|
|
1475
|
-
return typeof value !== "undefined";
|
|
1476
|
-
}
|
|
1477
|
-
Is2.defined = defined;
|
|
1478
|
-
function undefined2(value) {
|
|
1479
|
-
return typeof value === "undefined";
|
|
1480
|
-
}
|
|
1481
|
-
Is2.undefined = undefined2;
|
|
1482
|
-
function boolean(value) {
|
|
1483
|
-
return value === true || value === false;
|
|
1484
|
-
}
|
|
1485
|
-
Is2.boolean = boolean;
|
|
1486
|
-
function string(value) {
|
|
1487
|
-
return toString.call(value) === "[object String]";
|
|
1488
|
-
}
|
|
1489
|
-
Is2.string = string;
|
|
1490
|
-
function number(value) {
|
|
1491
|
-
return toString.call(value) === "[object Number]";
|
|
1492
|
-
}
|
|
1493
|
-
Is2.number = number;
|
|
1494
|
-
function numberRange(value, min, max) {
|
|
1495
|
-
return toString.call(value) === "[object Number]" && min <= value && value <= max;
|
|
1496
|
-
}
|
|
1497
|
-
Is2.numberRange = numberRange;
|
|
1498
|
-
function integer2(value) {
|
|
1499
|
-
return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
|
|
1500
|
-
}
|
|
1501
|
-
Is2.integer = integer2;
|
|
1502
|
-
function uinteger2(value) {
|
|
1503
|
-
return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
|
|
1504
|
-
}
|
|
1505
|
-
Is2.uinteger = uinteger2;
|
|
1506
|
-
function func(value) {
|
|
1507
|
-
return toString.call(value) === "[object Function]";
|
|
1508
|
-
}
|
|
1509
|
-
Is2.func = func;
|
|
1510
|
-
function objectLiteral(value) {
|
|
1511
|
-
return value !== null && typeof value === "object";
|
|
1512
|
-
}
|
|
1513
|
-
Is2.objectLiteral = objectLiteral;
|
|
1514
|
-
function typedArray(value, check) {
|
|
1515
|
-
return Array.isArray(value) && value.every(check);
|
|
1516
|
-
}
|
|
1517
|
-
Is2.typedArray = typedArray;
|
|
1518
|
-
})(Is || (Is = {}));
|
|
1519
|
-
|
|
1520
|
-
// src/services/languageKeywords.ts
|
|
1521
|
-
var ArcadeKeywords = Object.values(Keywords);
|
|
1522
|
-
var ArcadeLiterals = Object.values(Literals);
|
|
1523
|
-
|
|
1524
|
-
// src/services/arcade-completetion/snippets.ts
|
|
1525
|
-
ArcadeLiterals.map((label) => ({ label, kind: CompletionItemKind.Constant }));
|
|
1526
|
-
ArcadeKeywords.map((label) => ({ label, kind: CompletionItemKind.Keyword }));
|
|
1527
|
-
|
|
1528
|
-
const operators = [
|
|
1529
|
-
"<=",
|
|
1530
|
-
">=",
|
|
1531
|
-
"==",
|
|
1532
|
-
"!=",
|
|
1533
|
-
"+",
|
|
1534
|
-
"-",
|
|
1535
|
-
"*",
|
|
1536
|
-
"/",
|
|
1537
|
-
"%",
|
|
1538
|
-
"++",
|
|
1539
|
-
"--",
|
|
1540
|
-
"<<",
|
|
1541
|
-
">>",
|
|
1542
|
-
">>>",
|
|
1543
|
-
"&",
|
|
1544
|
-
"|",
|
|
1545
|
-
"^",
|
|
1546
|
-
"!",
|
|
1547
|
-
"~",
|
|
1548
|
-
"&&",
|
|
1549
|
-
"||",
|
|
1550
|
-
"=",
|
|
1551
|
-
"+=",
|
|
1552
|
-
"-=",
|
|
1553
|
-
"*=",
|
|
1554
|
-
"**=",
|
|
1555
|
-
"/=",
|
|
1556
|
-
"%="
|
|
1557
|
-
];
|
|
1558
|
-
const arcadeLanguageConfiguration = {
|
|
1559
|
-
// the default separators except `@$`
|
|
1560
|
-
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
1561
|
-
comments: {
|
|
1562
|
-
lineComment: "//",
|
|
1563
|
-
blockComment: ["/*", "*/"]
|
|
1564
|
-
},
|
|
1565
|
-
brackets: [
|
|
1566
|
-
["{", "}"],
|
|
1567
|
-
["[", "]"],
|
|
1568
|
-
["(", ")"]
|
|
1569
|
-
],
|
|
1570
|
-
autoClosingPairs: [
|
|
1571
|
-
{ open: "{", close: "}" },
|
|
1572
|
-
{ open: "[", close: "]" },
|
|
1573
|
-
{ open: "(", close: ")" },
|
|
1574
|
-
{ open: '"', close: '"', notIn: ["string"] },
|
|
1575
|
-
{ open: "'", close: "'", notIn: ["string", "comment"] },
|
|
1576
|
-
{ open: "`", close: "`", notIn: ["string", "comment"] }
|
|
1577
|
-
],
|
|
1578
|
-
autoCloseBefore: ";:.,=}])` \n\t",
|
|
1579
|
-
folding: {
|
|
1580
|
-
markers: {
|
|
1581
|
-
start: new RegExp("^\\s*//\\s*#?region\\b"),
|
|
1582
|
-
end: new RegExp("^\\s*//\\s*#?endregion\\b")
|
|
1583
|
-
}
|
|
1584
|
-
},
|
|
1585
|
-
indentationRules: {
|
|
1586
|
-
// ^(.*\*/)?\s*\}.*$
|
|
1587
|
-
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]\)].*$/,
|
|
1588
|
-
// ^.*\{[^}"']*$
|
|
1589
|
-
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
const arcadeMonarchLanguage = {
|
|
1593
|
-
// Set defaultToken to invalid to see what you do not tokenize yet
|
|
1594
|
-
defaultToken: "invalid",
|
|
1595
|
-
tokenPostfix: ".arc",
|
|
1596
|
-
// Arcade is case insensitive
|
|
1597
|
-
ignoreCase: true,
|
|
1598
|
-
// builtinFunctions: Array.from(arcadeService.FunctionNames),
|
|
1599
|
-
// Arcade keywords. 'from' is a special case as we want to treat it as a keyword in
|
|
1600
|
-
// import statement but as an identifer in var statement.
|
|
1601
|
-
keywords: ArcadeKeywords.filter((k) => k !== "from"),
|
|
1602
|
-
operators,
|
|
1603
|
-
constants: ["true", "false", "null"],
|
|
1604
|
-
// we include these common regular expressions
|
|
1605
|
-
symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
1606
|
-
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
1607
|
-
digits: /\d+(_+\d+)*/,
|
|
1608
|
-
octaldigits: /[0-7]+(_+[0-7]+)*/,
|
|
1609
|
-
binarydigits: /[0-1]+(_+[0-1]+)*/,
|
|
1610
|
-
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
|
|
1611
|
-
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
|
|
1612
|
-
regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
|
|
1613
|
-
// The main tokenizer for our languages
|
|
1614
|
-
tokenizer: {
|
|
1615
|
-
root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
|
|
1616
|
-
common: [
|
|
1617
|
-
// import statement. import followed by a white space
|
|
1618
|
-
[/import(?=\s)/, { token: "keyword", next: "@import" }],
|
|
1619
|
-
// identifiers and keywords
|
|
1620
|
-
[
|
|
1621
|
-
/[a-z_$][\w$]*/,
|
|
1622
|
-
{
|
|
1623
|
-
cases: {
|
|
1624
|
-
"@constants": "constant",
|
|
1625
|
-
"@keywords": "keyword",
|
|
1626
|
-
"@default": "identifier"
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
],
|
|
1630
|
-
// whitespace
|
|
1631
|
-
{ include: "@whitespace" },
|
|
1632
|
-
// regular expression: ensure it is terminated before beginning (otherwise it is an opeator)
|
|
1633
|
-
[
|
|
1634
|
-
/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|\/|,|\)|\]|\}|$))/,
|
|
1635
|
-
{ token: "regexp", bracket: "@open", next: "@regexp" }
|
|
1636
|
-
],
|
|
1637
|
-
// delimiters and operators
|
|
1638
|
-
[/[()\[\]]/, "@brackets"],
|
|
1639
|
-
[/[<>](?!@symbols)/, "@brackets"],
|
|
1640
|
-
[
|
|
1641
|
-
/@symbols/,
|
|
1642
|
-
{
|
|
1643
|
-
cases: {
|
|
1644
|
-
"@operators": "delimiter",
|
|
1645
|
-
"@default": ""
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
],
|
|
1649
|
-
// numbers
|
|
1650
|
-
[/(@digits)[eE]([\-+]?(@digits))?/, "number"],
|
|
1651
|
-
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number"],
|
|
1652
|
-
[/0[xX](@hexdigits)/, "number"],
|
|
1653
|
-
[/0[oO]?(@octaldigits)/, "number"],
|
|
1654
|
-
[/0[bB](@binarydigits)/, "number"],
|
|
1655
|
-
[/(@digits)/, "number"],
|
|
1656
|
-
// delimiter: after number because of .\d floats
|
|
1657
|
-
[/[;,.]/, "delimiter"],
|
|
1658
|
-
// strings
|
|
1659
|
-
[/"([^"\\]|\\.)*$/, "string.invalid"],
|
|
1660
|
-
[/'([^'\\]|\\.)*$/, "string.invalid"],
|
|
1661
|
-
[/"/, "string", "@string_double"],
|
|
1662
|
-
[/'/, "string", "@string_single"],
|
|
1663
|
-
[/`/, "string", "@string_backtick"]
|
|
1664
|
-
],
|
|
1665
|
-
import: [
|
|
1666
|
-
// import keyword
|
|
1667
|
-
[/import(?=\s)/, { token: "keyword" }],
|
|
1668
|
-
// whitespace
|
|
1669
|
-
{ include: "@whitespace" },
|
|
1670
|
-
// identifier
|
|
1671
|
-
[/[a-z_$][\w$]*/, "identifier"],
|
|
1672
|
-
// whitespace
|
|
1673
|
-
{ include: "@whitespace" },
|
|
1674
|
-
// from keyword
|
|
1675
|
-
[/from/, { token: "keyword", next: "@popall" }]
|
|
1676
|
-
],
|
|
1677
|
-
whitespace: [
|
|
1678
|
-
[/[ \t\r\n]+/, ""],
|
|
1679
|
-
[/\/\*/, "comment", "@comment"],
|
|
1680
|
-
[/\/\/.*$/, "comment"]
|
|
1681
|
-
],
|
|
1682
|
-
comment: [
|
|
1683
|
-
[/[^\/*]+/, "comment"],
|
|
1684
|
-
[/\*\//, "comment", "@pop"],
|
|
1685
|
-
[/[\/*]/, "comment"]
|
|
1686
|
-
],
|
|
1687
|
-
// We match regular expression quite precisely
|
|
1688
|
-
regexp: [
|
|
1689
|
-
[/(\{)(\d+(?:,\d*)?)(\})/, ["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]],
|
|
1690
|
-
[
|
|
1691
|
-
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
|
|
1692
|
-
["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
|
|
1693
|
-
],
|
|
1694
|
-
[/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
|
|
1695
|
-
[/[()]/, "regexp.escape.control"],
|
|
1696
|
-
[/@regexpctl/, "regexp.escape.control"],
|
|
1697
|
-
[/[^\\\/]/, "regexp"],
|
|
1698
|
-
[/@regexpesc/, "regexp.escape"],
|
|
1699
|
-
[/\\\./, "regexp.invalid"],
|
|
1700
|
-
[/(\/)([gimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
|
|
1701
|
-
],
|
|
1702
|
-
regexrange: [
|
|
1703
|
-
[/-/, "regexp.escape.control"],
|
|
1704
|
-
[/\^/, "regexp.invalid"],
|
|
1705
|
-
[/@regexpesc/, "regexp.escape"],
|
|
1706
|
-
[/[^\]]/, "regexp"],
|
|
1707
|
-
[/\]/, { token: "regexp.escape.control", next: "@pop", bracket: "@close" }]
|
|
1708
|
-
],
|
|
1709
|
-
string_double: [
|
|
1710
|
-
[/[^\\"]+/, "string"],
|
|
1711
|
-
[/@escapes/, "string.escape"],
|
|
1712
|
-
[/\\./, "string.escape.invalid"],
|
|
1713
|
-
[/"/, "string", "@pop"]
|
|
1714
|
-
],
|
|
1715
|
-
string_single: [
|
|
1716
|
-
[/[^\\']+/, "string"],
|
|
1717
|
-
[/@escapes/, "string.escape"],
|
|
1718
|
-
[/\\./, "string.escape.invalid"],
|
|
1719
|
-
[/'/, "string", "@pop"]
|
|
1720
|
-
],
|
|
1721
|
-
string_backtick: [
|
|
1722
|
-
[/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
|
|
1723
|
-
[/[^\\`$]+/, "string"],
|
|
1724
|
-
[/@escapes/, "string.escape"],
|
|
1725
|
-
[/\\./, "string.escape.invalid"],
|
|
1726
|
-
[/`/, "string", "@pop"]
|
|
1727
|
-
],
|
|
1728
|
-
bracketCounting: [
|
|
1729
|
-
[/\{/, "delimiter.bracket", "@bracketCounting"],
|
|
1730
|
-
[/\}/, "delimiter.bracket", "@pop"],
|
|
1731
|
-
{ include: "common" }
|
|
1732
|
-
]
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
|
|
1736
|
-
//#region Diagnostic
|
|
1737
|
-
class DiagnosticsAdapter {
|
|
1738
|
-
constructor(_languageId, _worker, { defaults, diagnosticsService }) {
|
|
1739
|
-
this._languageId = _languageId;
|
|
1740
|
-
this._worker = _worker;
|
|
1741
|
-
this._disposables = [];
|
|
1742
|
-
this._listener = Object.create(null);
|
|
1743
|
-
this._diagnosticsService = diagnosticsService;
|
|
1744
|
-
this._defaults = defaults;
|
|
1745
|
-
const onModelAdd = (model) => {
|
|
1746
|
-
const languageId = model.getLanguageId();
|
|
1747
|
-
if (languageId !== this._languageId) {
|
|
1748
|
-
return;
|
|
1749
|
-
}
|
|
1750
|
-
let handle;
|
|
1751
|
-
this._listener[model.uri.toString()] = model.onDidChangeContent(() => {
|
|
1752
|
-
window.clearTimeout(handle);
|
|
1753
|
-
handle = window.setTimeout(() => this._doValidate(model, languageId), 500);
|
|
1754
|
-
});
|
|
1755
|
-
this._doValidate(model, languageId);
|
|
1756
|
-
};
|
|
1757
|
-
const onModelRemoved = (model) => {
|
|
1758
|
-
const uriStr = model.uri.toString();
|
|
1759
|
-
arcadeDefaults.editor.setModelMarkers(model, this._languageId, []);
|
|
1760
|
-
const listener = this._listener[uriStr];
|
|
1761
|
-
if (listener) {
|
|
1762
|
-
listener.dispose();
|
|
1763
|
-
delete this._listener[uriStr];
|
|
1764
|
-
}
|
|
1765
|
-
};
|
|
1766
|
-
this._disposables.push(arcadeDefaults.editor.onDidCreateModel(onModelAdd));
|
|
1767
|
-
this._disposables.push(arcadeDefaults.editor.onWillDisposeModel((model) => {
|
|
1768
|
-
onModelRemoved(model);
|
|
1769
|
-
}));
|
|
1770
|
-
this._disposables.push(arcadeDefaults.editor.onDidChangeModelLanguage((event) => {
|
|
1771
|
-
onModelRemoved(event.model);
|
|
1772
|
-
onModelAdd(event.model);
|
|
1773
|
-
}));
|
|
1774
|
-
this._disposables.push(defaults.onDidChange(() => {
|
|
1775
|
-
arcadeDefaults.editor.getModels().forEach((model) => {
|
|
1776
|
-
if (model.getLanguageId() === this._languageId) {
|
|
1777
|
-
onModelRemoved(model);
|
|
1778
|
-
onModelAdd(model);
|
|
1779
|
-
}
|
|
1780
|
-
});
|
|
1781
|
-
}));
|
|
1782
|
-
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
1783
|
-
arcadeDefaults.editor.getModels().forEach((model) => {
|
|
1784
|
-
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
1785
|
-
this._doValidate(model, this._languageId);
|
|
1786
|
-
}
|
|
1787
|
-
});
|
|
1788
|
-
}));
|
|
1789
|
-
this._disposables.push({
|
|
1790
|
-
dispose: () => {
|
|
1791
|
-
for (const key in this._listener) {
|
|
1792
|
-
this._listener[key].dispose();
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
});
|
|
1796
|
-
arcadeDefaults.editor.getModels().forEach(onModelAdd);
|
|
1797
|
-
}
|
|
1798
|
-
dispose() {
|
|
1799
|
-
this._disposables.forEach((d) => d && d.dispose());
|
|
1800
|
-
this._disposables = [];
|
|
1801
|
-
}
|
|
1802
|
-
async _doValidate(model, languageId) {
|
|
1803
|
-
if (!model.isAttachedToEditor()) {
|
|
1804
|
-
return;
|
|
1805
|
-
}
|
|
1806
|
-
try {
|
|
1807
|
-
const workerProxy = await this._worker(model.uri);
|
|
1808
|
-
const context = this._defaults.getApiContextForModel(model.uri);
|
|
1809
|
-
const diagnostics = await workerProxy.doValidation(model.uri.toString(), context);
|
|
1810
|
-
const markers = diagnostics.map((d) => toMarker(model.uri, d));
|
|
1811
|
-
this._diagnosticsService.fireDiagnosticsChange(model.uri, diagnostics);
|
|
1812
|
-
arcadeDefaults.editor.setModelMarkers(model, languageId, markers);
|
|
1813
|
-
}
|
|
1814
|
-
catch (err) {
|
|
1815
|
-
console.error(err);
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
function toSeverity(languageServiceSeverity) {
|
|
1820
|
-
switch (languageServiceSeverity) {
|
|
1821
|
-
case arcadeDefaults.DiagnosticSeverity.Error:
|
|
1822
|
-
return arcadeDefaults.MarkerSeverity.Error;
|
|
1823
|
-
case arcadeDefaults.DiagnosticSeverity.Warning:
|
|
1824
|
-
return arcadeDefaults.MarkerSeverity.Warning;
|
|
1825
|
-
case arcadeDefaults.DiagnosticSeverity.Information:
|
|
1826
|
-
return arcadeDefaults.MarkerSeverity.Info;
|
|
1827
|
-
case arcadeDefaults.DiagnosticSeverity.Hint:
|
|
1828
|
-
return arcadeDefaults.MarkerSeverity.Hint;
|
|
1829
|
-
default:
|
|
1830
|
-
return arcadeDefaults.MarkerSeverity.Info;
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
function toMarker(_resource, diag) {
|
|
1834
|
-
// Diagnostics positions are zero-based, MarkerData are 1-based
|
|
1835
|
-
return {
|
|
1836
|
-
severity: toSeverity(diag.severity),
|
|
1837
|
-
startLineNumber: diag.range.start.line + 1,
|
|
1838
|
-
startColumn: diag.range.start.character + 1,
|
|
1839
|
-
endLineNumber: diag.range.end.line + 1,
|
|
1840
|
-
endColumn: diag.range.end.character + 1,
|
|
1841
|
-
message: diag.message
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
//#endregion
|
|
1845
|
-
//#region Completion
|
|
1846
|
-
function fromPosition(position) {
|
|
1847
|
-
// Language service is zero based
|
|
1848
|
-
return { character: position.column - 1, line: position.lineNumber - 1 };
|
|
1849
|
-
}
|
|
1850
|
-
function toRange(range) {
|
|
1851
|
-
return new arcadeDefaults.Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
|
|
1852
|
-
}
|
|
1853
|
-
function toTextEdit(textEdit) {
|
|
1854
|
-
return {
|
|
1855
|
-
range: toRange(textEdit.range),
|
|
1856
|
-
text: textEdit.newText
|
|
1857
|
-
};
|
|
1858
|
-
}
|
|
1859
|
-
function isInsertReplaceEdit(edit) {
|
|
1860
|
-
return (typeof edit.insert !== "undefined" && typeof edit.replace !== "undefined");
|
|
1861
|
-
}
|
|
1862
|
-
function toCompletionItemKind(kind) {
|
|
1863
|
-
const mItemKind = arcadeDefaults.languages.CompletionItemKind;
|
|
1864
|
-
switch (kind) {
|
|
1865
|
-
case arcadeDefaults.CompletionItemKind.Text:
|
|
1866
|
-
return mItemKind.Text;
|
|
1867
|
-
case arcadeDefaults.CompletionItemKind.Method:
|
|
1868
|
-
return mItemKind.Method;
|
|
1869
|
-
case arcadeDefaults.CompletionItemKind.Function:
|
|
1870
|
-
return mItemKind.Function;
|
|
1871
|
-
case arcadeDefaults.CompletionItemKind.Constructor:
|
|
1872
|
-
return mItemKind.Constructor;
|
|
1873
|
-
case arcadeDefaults.CompletionItemKind.Field:
|
|
1874
|
-
return mItemKind.Field;
|
|
1875
|
-
case arcadeDefaults.CompletionItemKind.Variable:
|
|
1876
|
-
return mItemKind.Variable;
|
|
1877
|
-
case arcadeDefaults.CompletionItemKind.Class:
|
|
1878
|
-
return mItemKind.Class;
|
|
1879
|
-
case arcadeDefaults.CompletionItemKind.Interface:
|
|
1880
|
-
return mItemKind.Interface;
|
|
1881
|
-
case arcadeDefaults.CompletionItemKind.Module:
|
|
1882
|
-
return mItemKind.Module;
|
|
1883
|
-
case arcadeDefaults.CompletionItemKind.Property:
|
|
1884
|
-
return mItemKind.Property;
|
|
1885
|
-
case arcadeDefaults.CompletionItemKind.Unit:
|
|
1886
|
-
return mItemKind.Unit;
|
|
1887
|
-
case arcadeDefaults.CompletionItemKind.Value:
|
|
1888
|
-
return mItemKind.Value;
|
|
1889
|
-
case arcadeDefaults.CompletionItemKind.Enum:
|
|
1890
|
-
return mItemKind.Enum;
|
|
1891
|
-
case arcadeDefaults.CompletionItemKind.Keyword:
|
|
1892
|
-
return mItemKind.Keyword;
|
|
1893
|
-
case arcadeDefaults.CompletionItemKind.Snippet:
|
|
1894
|
-
return mItemKind.Snippet;
|
|
1895
|
-
case arcadeDefaults.CompletionItemKind.Color:
|
|
1896
|
-
return mItemKind.Color;
|
|
1897
|
-
case arcadeDefaults.CompletionItemKind.File:
|
|
1898
|
-
return mItemKind.File;
|
|
1899
|
-
case arcadeDefaults.CompletionItemKind.Reference:
|
|
1900
|
-
return mItemKind.Reference;
|
|
1901
|
-
case arcadeDefaults.CompletionItemKind.Folder:
|
|
1902
|
-
return mItemKind.Folder;
|
|
1903
|
-
case arcadeDefaults.CompletionItemKind.EnumMember:
|
|
1904
|
-
return mItemKind.EnumMember;
|
|
1905
|
-
case arcadeDefaults.CompletionItemKind.Constant:
|
|
1906
|
-
return mItemKind.Constant;
|
|
1907
|
-
case arcadeDefaults.CompletionItemKind.Struct:
|
|
1908
|
-
return mItemKind.Struct;
|
|
1909
|
-
case arcadeDefaults.CompletionItemKind.Event:
|
|
1910
|
-
return mItemKind.Event;
|
|
1911
|
-
case arcadeDefaults.CompletionItemKind.Operator:
|
|
1912
|
-
return mItemKind.Operator;
|
|
1913
|
-
case arcadeDefaults.CompletionItemKind.TypeParameter:
|
|
1914
|
-
return mItemKind.TypeParameter;
|
|
1915
|
-
}
|
|
1916
|
-
return mItemKind.Property;
|
|
1917
|
-
}
|
|
1918
|
-
class CompletionProvider {
|
|
1919
|
-
constructor(_worker, _defaults) {
|
|
1920
|
-
this._worker = _worker;
|
|
1921
|
-
this._defaults = _defaults;
|
|
1922
|
-
this.triggerCharacters = [".", "("];
|
|
1923
|
-
}
|
|
1924
|
-
async provideCompletionItems(model, position
|
|
1925
|
-
// _context: languages.CompletionContext,
|
|
1926
|
-
// _token: CancellationToken,
|
|
1927
|
-
) {
|
|
1928
|
-
const worker = await this._worker(model.uri);
|
|
1929
|
-
const context = this._defaults.getApiContextForModel(model.uri);
|
|
1930
|
-
const completionList = await worker.doComplete(model.uri.toString(), fromPosition(position), context);
|
|
1931
|
-
if (!completionList) {
|
|
1932
|
-
return;
|
|
1933
|
-
}
|
|
1934
|
-
const wordInfo = model.getWordUntilPosition(position);
|
|
1935
|
-
const wordRange = new arcadeDefaults.Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
|
|
1936
|
-
const items = completionList.items.map((entry) => {
|
|
1937
|
-
const item = {
|
|
1938
|
-
label: entry.label,
|
|
1939
|
-
insertText: entry.insertText || entry.label,
|
|
1940
|
-
sortText: entry.sortText,
|
|
1941
|
-
filterText: entry.filterText,
|
|
1942
|
-
detail: entry.detail,
|
|
1943
|
-
range: wordRange,
|
|
1944
|
-
kind: toCompletionItemKind(entry.kind)
|
|
1945
|
-
};
|
|
1946
|
-
if (entry.textEdit) {
|
|
1947
|
-
if (isInsertReplaceEdit(entry.textEdit)) {
|
|
1948
|
-
item.range = {
|
|
1949
|
-
insert: toRange(entry.textEdit.insert),
|
|
1950
|
-
replace: toRange(entry.textEdit.replace)
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
else {
|
|
1954
|
-
item.range = toRange(entry.textEdit.range);
|
|
1955
|
-
}
|
|
1956
|
-
item.insertText = entry.textEdit.newText;
|
|
1957
|
-
}
|
|
1958
|
-
if (entry.additionalTextEdits) {
|
|
1959
|
-
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
|
1960
|
-
}
|
|
1961
|
-
if (entry.insertTextFormat === arcadeDefaults.InsertTextFormat.Snippet) {
|
|
1962
|
-
item.insertTextRules = arcadeDefaults.languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
1963
|
-
}
|
|
1964
|
-
if (entry.documentation) {
|
|
1965
|
-
if (typeof entry.documentation === "string") {
|
|
1966
|
-
item.documentation = entry.documentation;
|
|
1967
|
-
}
|
|
1968
|
-
else {
|
|
1969
|
-
item.documentation = {
|
|
1970
|
-
supportThemeIcons: false,
|
|
1971
|
-
value: entry.documentation.value,
|
|
1972
|
-
supportHtml: true
|
|
1973
|
-
};
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
return item;
|
|
1977
|
-
});
|
|
1978
|
-
return {
|
|
1979
|
-
incomplete: completionList.isIncomplete,
|
|
1980
|
-
suggestions: items
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
//#endregion
|
|
1985
|
-
//#region Formatter
|
|
1986
|
-
class FormattingProvider {
|
|
1987
|
-
constructor(_worker, _defaults) {
|
|
1988
|
-
this._worker = _worker;
|
|
1989
|
-
this._defaults = _defaults;
|
|
1990
|
-
}
|
|
1991
|
-
async provideDocumentFormattingEdits(model
|
|
1992
|
-
// _options: languages.FormattingOptions,
|
|
1993
|
-
// _token: CancellationToken,
|
|
1994
|
-
) {
|
|
1995
|
-
const worker = await this._worker(model.uri);
|
|
1996
|
-
const context = this._defaults.getApiContextForModel(model.uri.toString());
|
|
1997
|
-
const edits = await worker.doFormat(model.uri.toString(), context);
|
|
1998
|
-
if (!edits) {
|
|
1999
|
-
return [];
|
|
2000
|
-
}
|
|
2001
|
-
return edits.map((e) => ({ range: toRange(e.range), text: e.newText }));
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
//#endregion
|
|
2005
|
-
|
|
2006
|
-
/**
|
|
2007
|
-
* Manager to create our arcade worker and client proxy
|
|
2008
|
-
*/
|
|
2009
|
-
class WorkerManager {
|
|
2010
|
-
constructor(_defaults) {
|
|
2011
|
-
this._defaults = _defaults;
|
|
2012
|
-
this._worker = null;
|
|
2013
|
-
this._client = null;
|
|
2014
|
-
// Observes the arcade defaults. If modified then stop the worker.
|
|
2015
|
-
this._configChangeListener = this._defaults.onDidChange(() => this.stopWorker());
|
|
2016
|
-
}
|
|
2017
|
-
dispose() {
|
|
2018
|
-
this._configChangeListener.dispose();
|
|
2019
|
-
this.stopWorker();
|
|
2020
|
-
}
|
|
2021
|
-
stopWorker() {
|
|
2022
|
-
if (this._worker) {
|
|
2023
|
-
this._worker.dispose();
|
|
2024
|
-
this._worker = null;
|
|
2025
|
-
}
|
|
2026
|
-
this._client = null;
|
|
2027
|
-
}
|
|
2028
|
-
_getClientProxy() {
|
|
2029
|
-
// We used createWebWorker to create or run the web worker if it isn’t already created.
|
|
2030
|
-
// Otherwise, we get and return the proxy client.
|
|
2031
|
-
if (!this._client) {
|
|
2032
|
-
const { languageId, languageOptions } = this._defaults;
|
|
2033
|
-
this._worker = arcadeDefaults.editor.createWebWorker({
|
|
2034
|
-
moduleId: "ArcadeWorker",
|
|
2035
|
-
label: languageId,
|
|
2036
|
-
createData: {
|
|
2037
|
-
languageId,
|
|
2038
|
-
languageOptions
|
|
2039
|
-
}
|
|
2040
|
-
});
|
|
2041
|
-
this._client = this._worker.getProxy();
|
|
2042
|
-
}
|
|
2043
|
-
return this._client;
|
|
2044
|
-
}
|
|
2045
|
-
async getLanguageServiceWorker(...resources) {
|
|
2046
|
-
const _client = await this._getClientProxy();
|
|
2047
|
-
await this._worker?.withSyncedResources(resources);
|
|
2048
|
-
return _client;
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
let arcadeWorker;
|
|
2053
|
-
/**
|
|
2054
|
-
* Returns the arcade worker for the model uris.
|
|
2055
|
-
* @param uris The model uris for which to get the worker.
|
|
2056
|
-
* @returns The arcade worker.
|
|
2057
|
-
*/
|
|
2058
|
-
async function getArcadeWorker(...uris) {
|
|
2059
|
-
return new Promise((resolve, reject) => {
|
|
2060
|
-
if (!arcadeWorker) {
|
|
2061
|
-
return reject("TypeScript not registered!");
|
|
2062
|
-
}
|
|
2063
|
-
resolve(arcadeWorker(...uris));
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* The Arcade Language Diagnostic Service.
|
|
2068
|
-
* Consumers can listen to the diagnostics change event to get notified when the diagnostics change.
|
|
2069
|
-
*/
|
|
2070
|
-
class ArcadeDiagnosticService {
|
|
2071
|
-
constructor() {
|
|
2072
|
-
this._onDiagnosticsChange = new arcadeDefaults.Emitter();
|
|
2073
|
-
}
|
|
2074
|
-
/**
|
|
2075
|
-
* An event to signal changes to the diagnostics.
|
|
2076
|
-
* The event value is the uri string and the diagnostics.
|
|
2077
|
-
*/
|
|
2078
|
-
get onDiagnosticsChange() {
|
|
2079
|
-
return this._onDiagnosticsChange.event;
|
|
2080
|
-
}
|
|
2081
|
-
/**
|
|
2082
|
-
* Fires the diagnostics change event.
|
|
2083
|
-
* @param uri The uri of the model for which the diagnostics changed.
|
|
2084
|
-
* @param diagnostics The diagnostics for the model.
|
|
2085
|
-
*/
|
|
2086
|
-
fireDiagnosticsChange(uri, diagnostics) {
|
|
2087
|
-
this._onDiagnosticsChange.fire({ uri, diagnostics });
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
const arcadeDiagnosticService = new ArcadeDiagnosticService();
|
|
2091
|
-
/**
|
|
2092
|
-
* Get the Arcade Diagnostic Service.
|
|
2093
|
-
* @returns The Arcade Language Diagnostic Service.
|
|
2094
|
-
*/
|
|
2095
|
-
function getArcadeDiagnosticService() {
|
|
2096
|
-
return arcadeDiagnosticService;
|
|
2097
|
-
}
|
|
2098
|
-
function setupMode(arcadeDefaults$1) {
|
|
2099
|
-
const client = new WorkerManager(arcadeDefaults$1);
|
|
2100
|
-
const workerAccessor = (...uris) => client.getLanguageServiceWorker(...uris);
|
|
2101
|
-
arcadeWorker = workerAccessor;
|
|
2102
|
-
// Use the arcade Monarch Json to define the highlighting
|
|
2103
|
-
arcadeDefaults.languages.setMonarchTokensProvider(arcadeDefaults$1.languageId, arcadeMonarchLanguage);
|
|
2104
|
-
arcadeDefaults.languages.setLanguageConfiguration(arcadeDefaults$1.languageId, arcadeLanguageConfiguration);
|
|
2105
|
-
// Creates and registers a Completion Adapter
|
|
2106
|
-
arcadeDefaults.languages.registerCompletionItemProvider(arcadeDefaults$1.languageId, new CompletionProvider(workerAccessor, arcadeDefaults$1));
|
|
2107
|
-
// Creates and registers a Formatter
|
|
2108
|
-
arcadeDefaults.languages.registerDocumentFormattingEditProvider(arcadeDefaults$1.languageId, new FormattingProvider(workerAccessor, arcadeDefaults$1));
|
|
2109
|
-
// Creates a Diagnostic Adapter
|
|
2110
|
-
new DiagnosticsAdapter(arcadeDefaults$1.languageId, workerAccessor, {
|
|
2111
|
-
defaults: arcadeDefaults$1,
|
|
2112
|
-
diagnosticsService: arcadeDiagnosticService
|
|
2113
|
-
});
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
exports.getArcadeDiagnosticService = getArcadeDiagnosticService;
|
|
2117
|
-
exports.getArcadeWorker = getArcadeWorker;
|
|
2118
|
-
exports.setupMode = setupMode;
|