@codingame/monaco-vscode-standalone-html-language-features 6.0.2 → 6.0.3
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/htmlMode.js +398 -488
- package/index.js +1 -1
- package/package.json +2 -2
- package/worker.js +2728 -2781
package/htmlMode.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as monaco_editor_core_star from 'monaco-editor';
|
|
|
2
2
|
|
|
3
3
|
/*!-----------------------------------------------------------------------------
|
|
4
4
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Version: 0.
|
|
5
|
+
* Version: 0.50.0(undefined)
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
8
8
|
*-----------------------------------------------------------------------------*/
|
|
@@ -87,15 +87,37 @@ var WorkerManager = class {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
// node_modules/vscode-languageserver-types/lib/esm/main.js
|
|
90
|
+
var DocumentUri;
|
|
91
|
+
(function(DocumentUri2) {
|
|
92
|
+
function is(value) {
|
|
93
|
+
return typeof value === "string";
|
|
94
|
+
}
|
|
95
|
+
DocumentUri2.is = is;
|
|
96
|
+
})(DocumentUri || (DocumentUri = {}));
|
|
97
|
+
var URI;
|
|
98
|
+
(function(URI2) {
|
|
99
|
+
function is(value) {
|
|
100
|
+
return typeof value === "string";
|
|
101
|
+
}
|
|
102
|
+
URI2.is = is;
|
|
103
|
+
})(URI || (URI = {}));
|
|
90
104
|
var integer;
|
|
91
105
|
(function(integer2) {
|
|
92
106
|
integer2.MIN_VALUE = -2147483648;
|
|
93
107
|
integer2.MAX_VALUE = 2147483647;
|
|
108
|
+
function is(value) {
|
|
109
|
+
return typeof value === "number" && integer2.MIN_VALUE <= value && value <= integer2.MAX_VALUE;
|
|
110
|
+
}
|
|
111
|
+
integer2.is = is;
|
|
94
112
|
})(integer || (integer = {}));
|
|
95
113
|
var uinteger;
|
|
96
114
|
(function(uinteger2) {
|
|
97
115
|
uinteger2.MIN_VALUE = 0;
|
|
98
116
|
uinteger2.MAX_VALUE = 2147483647;
|
|
117
|
+
function is(value) {
|
|
118
|
+
return typeof value === "number" && uinteger2.MIN_VALUE <= value && value <= uinteger2.MAX_VALUE;
|
|
119
|
+
}
|
|
120
|
+
uinteger2.is = is;
|
|
99
121
|
})(uinteger || (uinteger = {}));
|
|
100
122
|
var Position;
|
|
101
123
|
(function(Position3) {
|
|
@@ -110,7 +132,7 @@ var Position;
|
|
|
110
132
|
}
|
|
111
133
|
Position3.create = create;
|
|
112
134
|
function is(value) {
|
|
113
|
-
|
|
135
|
+
let candidate = value;
|
|
114
136
|
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
|
|
115
137
|
}
|
|
116
138
|
Position3.is = is;
|
|
@@ -123,12 +145,12 @@ var Range;
|
|
|
123
145
|
} else if (Position.is(one) && Position.is(two)) {
|
|
124
146
|
return { start: one, end: two };
|
|
125
147
|
} else {
|
|
126
|
-
throw new Error(
|
|
148
|
+
throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);
|
|
127
149
|
}
|
|
128
150
|
}
|
|
129
151
|
Range3.create = create;
|
|
130
152
|
function is(value) {
|
|
131
|
-
|
|
153
|
+
let candidate = value;
|
|
132
154
|
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
|
|
133
155
|
}
|
|
134
156
|
Range3.is = is;
|
|
@@ -140,8 +162,8 @@ var Location;
|
|
|
140
162
|
}
|
|
141
163
|
Location2.create = create;
|
|
142
164
|
function is(value) {
|
|
143
|
-
|
|
144
|
-
return Is.
|
|
165
|
+
let candidate = value;
|
|
166
|
+
return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
|
|
145
167
|
}
|
|
146
168
|
Location2.is = is;
|
|
147
169
|
})(Location || (Location = {}));
|
|
@@ -152,8 +174,8 @@ var LocationLink;
|
|
|
152
174
|
}
|
|
153
175
|
LocationLink2.create = create;
|
|
154
176
|
function is(value) {
|
|
155
|
-
|
|
156
|
-
return Is.
|
|
177
|
+
let candidate = value;
|
|
178
|
+
return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
|
|
157
179
|
}
|
|
158
180
|
LocationLink2.is = is;
|
|
159
181
|
})(LocationLink || (LocationLink = {}));
|
|
@@ -169,8 +191,8 @@ var Color;
|
|
|
169
191
|
}
|
|
170
192
|
Color2.create = create;
|
|
171
193
|
function is(value) {
|
|
172
|
-
|
|
173
|
-
return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
|
|
194
|
+
const candidate = value;
|
|
195
|
+
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);
|
|
174
196
|
}
|
|
175
197
|
Color2.is = is;
|
|
176
198
|
})(Color || (Color = {}));
|
|
@@ -184,8 +206,8 @@ var ColorInformation;
|
|
|
184
206
|
}
|
|
185
207
|
ColorInformation2.create = create;
|
|
186
208
|
function is(value) {
|
|
187
|
-
|
|
188
|
-
return Range.is(candidate.range) && Color.is(candidate.color);
|
|
209
|
+
const candidate = value;
|
|
210
|
+
return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);
|
|
189
211
|
}
|
|
190
212
|
ColorInformation2.is = is;
|
|
191
213
|
})(ColorInformation || (ColorInformation = {}));
|
|
@@ -200,21 +222,21 @@ var ColorPresentation;
|
|
|
200
222
|
}
|
|
201
223
|
ColorPresentation2.create = create;
|
|
202
224
|
function is(value) {
|
|
203
|
-
|
|
204
|
-
return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
|
|
225
|
+
const candidate = value;
|
|
226
|
+
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));
|
|
205
227
|
}
|
|
206
228
|
ColorPresentation2.is = is;
|
|
207
229
|
})(ColorPresentation || (ColorPresentation = {}));
|
|
208
230
|
var FoldingRangeKind;
|
|
209
231
|
(function(FoldingRangeKind2) {
|
|
210
|
-
FoldingRangeKind2
|
|
211
|
-
FoldingRangeKind2
|
|
212
|
-
FoldingRangeKind2
|
|
232
|
+
FoldingRangeKind2.Comment = "comment";
|
|
233
|
+
FoldingRangeKind2.Imports = "imports";
|
|
234
|
+
FoldingRangeKind2.Region = "region";
|
|
213
235
|
})(FoldingRangeKind || (FoldingRangeKind = {}));
|
|
214
236
|
var FoldingRange;
|
|
215
237
|
(function(FoldingRange2) {
|
|
216
|
-
function create(startLine, endLine, startCharacter, endCharacter, kind) {
|
|
217
|
-
|
|
238
|
+
function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {
|
|
239
|
+
const result = {
|
|
218
240
|
startLine,
|
|
219
241
|
endLine
|
|
220
242
|
};
|
|
@@ -227,12 +249,15 @@ var FoldingRange;
|
|
|
227
249
|
if (Is.defined(kind)) {
|
|
228
250
|
result.kind = kind;
|
|
229
251
|
}
|
|
252
|
+
if (Is.defined(collapsedText)) {
|
|
253
|
+
result.collapsedText = collapsedText;
|
|
254
|
+
}
|
|
230
255
|
return result;
|
|
231
256
|
}
|
|
232
257
|
FoldingRange2.create = create;
|
|
233
258
|
function is(value) {
|
|
234
|
-
|
|
235
|
-
return 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));
|
|
259
|
+
const candidate = value;
|
|
260
|
+
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));
|
|
236
261
|
}
|
|
237
262
|
FoldingRange2.is = is;
|
|
238
263
|
})(FoldingRange || (FoldingRange = {}));
|
|
@@ -246,7 +271,7 @@ var DiagnosticRelatedInformation;
|
|
|
246
271
|
}
|
|
247
272
|
DiagnosticRelatedInformation2.create = create;
|
|
248
273
|
function is(value) {
|
|
249
|
-
|
|
274
|
+
let candidate = value;
|
|
250
275
|
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
|
|
251
276
|
}
|
|
252
277
|
DiagnosticRelatedInformation2.is = is;
|
|
@@ -266,15 +291,15 @@ var DiagnosticTag;
|
|
|
266
291
|
var CodeDescription;
|
|
267
292
|
(function(CodeDescription2) {
|
|
268
293
|
function is(value) {
|
|
269
|
-
|
|
270
|
-
return candidate
|
|
294
|
+
const candidate = value;
|
|
295
|
+
return Is.objectLiteral(candidate) && Is.string(candidate.href);
|
|
271
296
|
}
|
|
272
297
|
CodeDescription2.is = is;
|
|
273
298
|
})(CodeDescription || (CodeDescription = {}));
|
|
274
299
|
var Diagnostic;
|
|
275
300
|
(function(Diagnostic2) {
|
|
276
301
|
function create(range, message, severity, code, source, relatedInformation) {
|
|
277
|
-
|
|
302
|
+
let result = { range, message };
|
|
278
303
|
if (Is.defined(severity)) {
|
|
279
304
|
result.severity = severity;
|
|
280
305
|
}
|
|
@@ -292,19 +317,15 @@ var Diagnostic;
|
|
|
292
317
|
Diagnostic2.create = create;
|
|
293
318
|
function is(value) {
|
|
294
319
|
var _a;
|
|
295
|
-
|
|
320
|
+
let candidate = value;
|
|
296
321
|
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));
|
|
297
322
|
}
|
|
298
323
|
Diagnostic2.is = is;
|
|
299
324
|
})(Diagnostic || (Diagnostic = {}));
|
|
300
325
|
var Command;
|
|
301
326
|
(function(Command2) {
|
|
302
|
-
function create(title, command) {
|
|
303
|
-
|
|
304
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
305
|
-
args[_i - 2] = arguments[_i];
|
|
306
|
-
}
|
|
307
|
-
var result = { title, command };
|
|
327
|
+
function create(title, command, ...args) {
|
|
328
|
+
let result = { title, command };
|
|
308
329
|
if (Is.defined(args) && args.length > 0) {
|
|
309
330
|
result.arguments = args;
|
|
310
331
|
}
|
|
@@ -312,7 +333,7 @@ var Command;
|
|
|
312
333
|
}
|
|
313
334
|
Command2.create = create;
|
|
314
335
|
function is(value) {
|
|
315
|
-
|
|
336
|
+
let candidate = value;
|
|
316
337
|
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
|
|
317
338
|
}
|
|
318
339
|
Command2.is = is;
|
|
@@ -332,7 +353,7 @@ var TextEdit;
|
|
|
332
353
|
}
|
|
333
354
|
TextEdit2.del = del;
|
|
334
355
|
function is(value) {
|
|
335
|
-
|
|
356
|
+
const candidate = value;
|
|
336
357
|
return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
|
|
337
358
|
}
|
|
338
359
|
TextEdit2.is = is;
|
|
@@ -340,7 +361,7 @@ var TextEdit;
|
|
|
340
361
|
var ChangeAnnotation;
|
|
341
362
|
(function(ChangeAnnotation2) {
|
|
342
363
|
function create(label, needsConfirmation, description) {
|
|
343
|
-
|
|
364
|
+
const result = { label };
|
|
344
365
|
if (needsConfirmation !== void 0) {
|
|
345
366
|
result.needsConfirmation = needsConfirmation;
|
|
346
367
|
}
|
|
@@ -351,16 +372,16 @@ var ChangeAnnotation;
|
|
|
351
372
|
}
|
|
352
373
|
ChangeAnnotation2.create = create;
|
|
353
374
|
function is(value) {
|
|
354
|
-
|
|
355
|
-
return
|
|
375
|
+
const candidate = value;
|
|
376
|
+
return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
|
|
356
377
|
}
|
|
357
378
|
ChangeAnnotation2.is = is;
|
|
358
379
|
})(ChangeAnnotation || (ChangeAnnotation = {}));
|
|
359
380
|
var ChangeAnnotationIdentifier;
|
|
360
381
|
(function(ChangeAnnotationIdentifier2) {
|
|
361
382
|
function is(value) {
|
|
362
|
-
|
|
363
|
-
return
|
|
383
|
+
const candidate = value;
|
|
384
|
+
return Is.string(candidate);
|
|
364
385
|
}
|
|
365
386
|
ChangeAnnotationIdentifier2.is = is;
|
|
366
387
|
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
|
|
@@ -379,7 +400,7 @@ var AnnotatedTextEdit;
|
|
|
379
400
|
}
|
|
380
401
|
AnnotatedTextEdit2.del = del;
|
|
381
402
|
function is(value) {
|
|
382
|
-
|
|
403
|
+
const candidate = value;
|
|
383
404
|
return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
|
|
384
405
|
}
|
|
385
406
|
AnnotatedTextEdit2.is = is;
|
|
@@ -391,7 +412,7 @@ var TextDocumentEdit;
|
|
|
391
412
|
}
|
|
392
413
|
TextDocumentEdit2.create = create;
|
|
393
414
|
function is(value) {
|
|
394
|
-
|
|
415
|
+
let candidate = value;
|
|
395
416
|
return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
|
|
396
417
|
}
|
|
397
418
|
TextDocumentEdit2.is = is;
|
|
@@ -399,7 +420,7 @@ var TextDocumentEdit;
|
|
|
399
420
|
var CreateFile;
|
|
400
421
|
(function(CreateFile2) {
|
|
401
422
|
function create(uri, options, annotation) {
|
|
402
|
-
|
|
423
|
+
let result = {
|
|
403
424
|
kind: "create",
|
|
404
425
|
uri
|
|
405
426
|
};
|
|
@@ -413,7 +434,7 @@ var CreateFile;
|
|
|
413
434
|
}
|
|
414
435
|
CreateFile2.create = create;
|
|
415
436
|
function is(value) {
|
|
416
|
-
|
|
437
|
+
let candidate = value;
|
|
417
438
|
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));
|
|
418
439
|
}
|
|
419
440
|
CreateFile2.is = is;
|
|
@@ -421,7 +442,7 @@ var CreateFile;
|
|
|
421
442
|
var RenameFile;
|
|
422
443
|
(function(RenameFile2) {
|
|
423
444
|
function create(oldUri, newUri, options, annotation) {
|
|
424
|
-
|
|
445
|
+
let result = {
|
|
425
446
|
kind: "rename",
|
|
426
447
|
oldUri,
|
|
427
448
|
newUri
|
|
@@ -436,7 +457,7 @@ var RenameFile;
|
|
|
436
457
|
}
|
|
437
458
|
RenameFile2.create = create;
|
|
438
459
|
function is(value) {
|
|
439
|
-
|
|
460
|
+
let candidate = value;
|
|
440
461
|
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));
|
|
441
462
|
}
|
|
442
463
|
RenameFile2.is = is;
|
|
@@ -444,7 +465,7 @@ var RenameFile;
|
|
|
444
465
|
var DeleteFile;
|
|
445
466
|
(function(DeleteFile2) {
|
|
446
467
|
function create(uri, options, annotation) {
|
|
447
|
-
|
|
468
|
+
let result = {
|
|
448
469
|
kind: "delete",
|
|
449
470
|
uri
|
|
450
471
|
};
|
|
@@ -458,7 +479,7 @@ var DeleteFile;
|
|
|
458
479
|
}
|
|
459
480
|
DeleteFile2.create = create;
|
|
460
481
|
function is(value) {
|
|
461
|
-
|
|
482
|
+
let candidate = value;
|
|
462
483
|
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));
|
|
463
484
|
}
|
|
464
485
|
DeleteFile2.is = is;
|
|
@@ -466,8 +487,8 @@ var DeleteFile;
|
|
|
466
487
|
var WorkspaceEdit;
|
|
467
488
|
(function(WorkspaceEdit2) {
|
|
468
489
|
function is(value) {
|
|
469
|
-
|
|
470
|
-
return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(
|
|
490
|
+
let candidate = value;
|
|
491
|
+
return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change) => {
|
|
471
492
|
if (Is.string(change.kind)) {
|
|
472
493
|
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
|
|
473
494
|
} else {
|
|
@@ -477,294 +498,6 @@ var WorkspaceEdit;
|
|
|
477
498
|
}
|
|
478
499
|
WorkspaceEdit2.is = is;
|
|
479
500
|
})(WorkspaceEdit || (WorkspaceEdit = {}));
|
|
480
|
-
var TextEditChangeImpl = (
|
|
481
|
-
/** @class */
|
|
482
|
-
function() {
|
|
483
|
-
function TextEditChangeImpl2(edits, changeAnnotations) {
|
|
484
|
-
this.edits = edits;
|
|
485
|
-
this.changeAnnotations = changeAnnotations;
|
|
486
|
-
}
|
|
487
|
-
TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) {
|
|
488
|
-
var edit;
|
|
489
|
-
var id;
|
|
490
|
-
if (annotation === void 0) {
|
|
491
|
-
edit = TextEdit.insert(position, newText);
|
|
492
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
493
|
-
id = annotation;
|
|
494
|
-
edit = AnnotatedTextEdit.insert(position, newText, annotation);
|
|
495
|
-
} else {
|
|
496
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
497
|
-
id = this.changeAnnotations.manage(annotation);
|
|
498
|
-
edit = AnnotatedTextEdit.insert(position, newText, id);
|
|
499
|
-
}
|
|
500
|
-
this.edits.push(edit);
|
|
501
|
-
if (id !== void 0) {
|
|
502
|
-
return id;
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) {
|
|
506
|
-
var edit;
|
|
507
|
-
var id;
|
|
508
|
-
if (annotation === void 0) {
|
|
509
|
-
edit = TextEdit.replace(range, newText);
|
|
510
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
511
|
-
id = annotation;
|
|
512
|
-
edit = AnnotatedTextEdit.replace(range, newText, annotation);
|
|
513
|
-
} else {
|
|
514
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
515
|
-
id = this.changeAnnotations.manage(annotation);
|
|
516
|
-
edit = AnnotatedTextEdit.replace(range, newText, id);
|
|
517
|
-
}
|
|
518
|
-
this.edits.push(edit);
|
|
519
|
-
if (id !== void 0) {
|
|
520
|
-
return id;
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
TextEditChangeImpl2.prototype.delete = function(range, annotation) {
|
|
524
|
-
var edit;
|
|
525
|
-
var id;
|
|
526
|
-
if (annotation === void 0) {
|
|
527
|
-
edit = TextEdit.del(range);
|
|
528
|
-
} else if (ChangeAnnotationIdentifier.is(annotation)) {
|
|
529
|
-
id = annotation;
|
|
530
|
-
edit = AnnotatedTextEdit.del(range, annotation);
|
|
531
|
-
} else {
|
|
532
|
-
this.assertChangeAnnotations(this.changeAnnotations);
|
|
533
|
-
id = this.changeAnnotations.manage(annotation);
|
|
534
|
-
edit = AnnotatedTextEdit.del(range, id);
|
|
535
|
-
}
|
|
536
|
-
this.edits.push(edit);
|
|
537
|
-
if (id !== void 0) {
|
|
538
|
-
return id;
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
TextEditChangeImpl2.prototype.add = function(edit) {
|
|
542
|
-
this.edits.push(edit);
|
|
543
|
-
};
|
|
544
|
-
TextEditChangeImpl2.prototype.all = function() {
|
|
545
|
-
return this.edits;
|
|
546
|
-
};
|
|
547
|
-
TextEditChangeImpl2.prototype.clear = function() {
|
|
548
|
-
this.edits.splice(0, this.edits.length);
|
|
549
|
-
};
|
|
550
|
-
TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) {
|
|
551
|
-
if (value === void 0) {
|
|
552
|
-
throw new Error("Text edit change is not configured to manage change annotations.");
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
return TextEditChangeImpl2;
|
|
556
|
-
}()
|
|
557
|
-
);
|
|
558
|
-
var ChangeAnnotations = (
|
|
559
|
-
/** @class */
|
|
560
|
-
function() {
|
|
561
|
-
function ChangeAnnotations2(annotations) {
|
|
562
|
-
this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations;
|
|
563
|
-
this._counter = 0;
|
|
564
|
-
this._size = 0;
|
|
565
|
-
}
|
|
566
|
-
ChangeAnnotations2.prototype.all = function() {
|
|
567
|
-
return this._annotations;
|
|
568
|
-
};
|
|
569
|
-
Object.defineProperty(ChangeAnnotations2.prototype, "size", {
|
|
570
|
-
get: function() {
|
|
571
|
-
return this._size;
|
|
572
|
-
},
|
|
573
|
-
enumerable: false,
|
|
574
|
-
configurable: true
|
|
575
|
-
});
|
|
576
|
-
ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) {
|
|
577
|
-
var id;
|
|
578
|
-
if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
|
|
579
|
-
id = idOrAnnotation;
|
|
580
|
-
} else {
|
|
581
|
-
id = this.nextId();
|
|
582
|
-
annotation = idOrAnnotation;
|
|
583
|
-
}
|
|
584
|
-
if (this._annotations[id] !== void 0) {
|
|
585
|
-
throw new Error("Id " + id + " is already in use.");
|
|
586
|
-
}
|
|
587
|
-
if (annotation === void 0) {
|
|
588
|
-
throw new Error("No annotation provided for id " + id);
|
|
589
|
-
}
|
|
590
|
-
this._annotations[id] = annotation;
|
|
591
|
-
this._size++;
|
|
592
|
-
return id;
|
|
593
|
-
};
|
|
594
|
-
ChangeAnnotations2.prototype.nextId = function() {
|
|
595
|
-
this._counter++;
|
|
596
|
-
return this._counter.toString();
|
|
597
|
-
};
|
|
598
|
-
return ChangeAnnotations2;
|
|
599
|
-
}()
|
|
600
|
-
);
|
|
601
|
-
(
|
|
602
|
-
/** @class */
|
|
603
|
-
(function() {
|
|
604
|
-
function WorkspaceChange2(workspaceEdit) {
|
|
605
|
-
var _this = this;
|
|
606
|
-
this._textEditChanges = /* @__PURE__ */ Object.create(null);
|
|
607
|
-
if (workspaceEdit !== void 0) {
|
|
608
|
-
this._workspaceEdit = workspaceEdit;
|
|
609
|
-
if (workspaceEdit.documentChanges) {
|
|
610
|
-
this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
|
|
611
|
-
workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
612
|
-
workspaceEdit.documentChanges.forEach(function(change) {
|
|
613
|
-
if (TextDocumentEdit.is(change)) {
|
|
614
|
-
var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
|
|
615
|
-
_this._textEditChanges[change.textDocument.uri] = textEditChange;
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
} else if (workspaceEdit.changes) {
|
|
619
|
-
Object.keys(workspaceEdit.changes).forEach(function(key) {
|
|
620
|
-
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
|
|
621
|
-
_this._textEditChanges[key] = textEditChange;
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
} else {
|
|
625
|
-
this._workspaceEdit = {};
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
Object.defineProperty(WorkspaceChange2.prototype, "edit", {
|
|
629
|
-
/**
|
|
630
|
-
* Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
|
|
631
|
-
* use to be returned from a workspace edit operation like rename.
|
|
632
|
-
*/
|
|
633
|
-
get: function() {
|
|
634
|
-
this.initDocumentChanges();
|
|
635
|
-
if (this._changeAnnotations !== void 0) {
|
|
636
|
-
if (this._changeAnnotations.size === 0) {
|
|
637
|
-
this._workspaceEdit.changeAnnotations = void 0;
|
|
638
|
-
} else {
|
|
639
|
-
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
return this._workspaceEdit;
|
|
643
|
-
},
|
|
644
|
-
enumerable: false,
|
|
645
|
-
configurable: true
|
|
646
|
-
});
|
|
647
|
-
WorkspaceChange2.prototype.getTextEditChange = function(key) {
|
|
648
|
-
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
|
|
649
|
-
this.initDocumentChanges();
|
|
650
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
651
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
652
|
-
}
|
|
653
|
-
var textDocument = { uri: key.uri, version: key.version };
|
|
654
|
-
var result = this._textEditChanges[textDocument.uri];
|
|
655
|
-
if (!result) {
|
|
656
|
-
var edits = [];
|
|
657
|
-
var textDocumentEdit = {
|
|
658
|
-
textDocument,
|
|
659
|
-
edits
|
|
660
|
-
};
|
|
661
|
-
this._workspaceEdit.documentChanges.push(textDocumentEdit);
|
|
662
|
-
result = new TextEditChangeImpl(edits, this._changeAnnotations);
|
|
663
|
-
this._textEditChanges[textDocument.uri] = result;
|
|
664
|
-
}
|
|
665
|
-
return result;
|
|
666
|
-
} else {
|
|
667
|
-
this.initChanges();
|
|
668
|
-
if (this._workspaceEdit.changes === void 0) {
|
|
669
|
-
throw new Error("Workspace edit is not configured for normal text edit changes.");
|
|
670
|
-
}
|
|
671
|
-
var result = this._textEditChanges[key];
|
|
672
|
-
if (!result) {
|
|
673
|
-
var edits = [];
|
|
674
|
-
this._workspaceEdit.changes[key] = edits;
|
|
675
|
-
result = new TextEditChangeImpl(edits);
|
|
676
|
-
this._textEditChanges[key] = result;
|
|
677
|
-
}
|
|
678
|
-
return result;
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
WorkspaceChange2.prototype.initDocumentChanges = function() {
|
|
682
|
-
if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
|
|
683
|
-
this._changeAnnotations = new ChangeAnnotations();
|
|
684
|
-
this._workspaceEdit.documentChanges = [];
|
|
685
|
-
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
WorkspaceChange2.prototype.initChanges = function() {
|
|
689
|
-
if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
|
|
690
|
-
this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null);
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
|
|
694
|
-
this.initDocumentChanges();
|
|
695
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
696
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
697
|
-
}
|
|
698
|
-
var annotation;
|
|
699
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
700
|
-
annotation = optionsOrAnnotation;
|
|
701
|
-
} else {
|
|
702
|
-
options = optionsOrAnnotation;
|
|
703
|
-
}
|
|
704
|
-
var operation;
|
|
705
|
-
var id;
|
|
706
|
-
if (annotation === void 0) {
|
|
707
|
-
operation = CreateFile.create(uri, options);
|
|
708
|
-
} else {
|
|
709
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
710
|
-
operation = CreateFile.create(uri, options, id);
|
|
711
|
-
}
|
|
712
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
713
|
-
if (id !== void 0) {
|
|
714
|
-
return id;
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) {
|
|
718
|
-
this.initDocumentChanges();
|
|
719
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
720
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
721
|
-
}
|
|
722
|
-
var annotation;
|
|
723
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
724
|
-
annotation = optionsOrAnnotation;
|
|
725
|
-
} else {
|
|
726
|
-
options = optionsOrAnnotation;
|
|
727
|
-
}
|
|
728
|
-
var operation;
|
|
729
|
-
var id;
|
|
730
|
-
if (annotation === void 0) {
|
|
731
|
-
operation = RenameFile.create(oldUri, newUri, options);
|
|
732
|
-
} else {
|
|
733
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
734
|
-
operation = RenameFile.create(oldUri, newUri, options, id);
|
|
735
|
-
}
|
|
736
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
737
|
-
if (id !== void 0) {
|
|
738
|
-
return id;
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) {
|
|
742
|
-
this.initDocumentChanges();
|
|
743
|
-
if (this._workspaceEdit.documentChanges === void 0) {
|
|
744
|
-
throw new Error("Workspace edit is not configured for document changes.");
|
|
745
|
-
}
|
|
746
|
-
var annotation;
|
|
747
|
-
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
|
|
748
|
-
annotation = optionsOrAnnotation;
|
|
749
|
-
} else {
|
|
750
|
-
options = optionsOrAnnotation;
|
|
751
|
-
}
|
|
752
|
-
var operation;
|
|
753
|
-
var id;
|
|
754
|
-
if (annotation === void 0) {
|
|
755
|
-
operation = DeleteFile.create(uri, options);
|
|
756
|
-
} else {
|
|
757
|
-
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
|
|
758
|
-
operation = DeleteFile.create(uri, options, id);
|
|
759
|
-
}
|
|
760
|
-
this._workspaceEdit.documentChanges.push(operation);
|
|
761
|
-
if (id !== void 0) {
|
|
762
|
-
return id;
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
return WorkspaceChange2;
|
|
766
|
-
})()
|
|
767
|
-
);
|
|
768
501
|
var TextDocumentIdentifier;
|
|
769
502
|
(function(TextDocumentIdentifier2) {
|
|
770
503
|
function create(uri) {
|
|
@@ -772,7 +505,7 @@ var TextDocumentIdentifier;
|
|
|
772
505
|
}
|
|
773
506
|
TextDocumentIdentifier2.create = create;
|
|
774
507
|
function is(value) {
|
|
775
|
-
|
|
508
|
+
let candidate = value;
|
|
776
509
|
return Is.defined(candidate) && Is.string(candidate.uri);
|
|
777
510
|
}
|
|
778
511
|
TextDocumentIdentifier2.is = is;
|
|
@@ -784,7 +517,7 @@ var VersionedTextDocumentIdentifier;
|
|
|
784
517
|
}
|
|
785
518
|
VersionedTextDocumentIdentifier2.create = create;
|
|
786
519
|
function is(value) {
|
|
787
|
-
|
|
520
|
+
let candidate = value;
|
|
788
521
|
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
|
|
789
522
|
}
|
|
790
523
|
VersionedTextDocumentIdentifier2.is = is;
|
|
@@ -796,7 +529,7 @@ var OptionalVersionedTextDocumentIdentifier;
|
|
|
796
529
|
}
|
|
797
530
|
OptionalVersionedTextDocumentIdentifier2.create = create;
|
|
798
531
|
function is(value) {
|
|
799
|
-
|
|
532
|
+
let candidate = value;
|
|
800
533
|
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
|
|
801
534
|
}
|
|
802
535
|
OptionalVersionedTextDocumentIdentifier2.is = is;
|
|
@@ -808,7 +541,7 @@ var TextDocumentItem;
|
|
|
808
541
|
}
|
|
809
542
|
TextDocumentItem2.create = create;
|
|
810
543
|
function is(value) {
|
|
811
|
-
|
|
544
|
+
let candidate = value;
|
|
812
545
|
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
|
|
813
546
|
}
|
|
814
547
|
TextDocumentItem2.is = is;
|
|
@@ -817,10 +550,8 @@ var MarkupKind;
|
|
|
817
550
|
(function(MarkupKind2) {
|
|
818
551
|
MarkupKind2.PlainText = "plaintext";
|
|
819
552
|
MarkupKind2.Markdown = "markdown";
|
|
820
|
-
})(MarkupKind || (MarkupKind = {}));
|
|
821
|
-
(function(MarkupKind2) {
|
|
822
553
|
function is(value) {
|
|
823
|
-
|
|
554
|
+
const candidate = value;
|
|
824
555
|
return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
|
|
825
556
|
}
|
|
826
557
|
MarkupKind2.is = is;
|
|
@@ -828,7 +559,7 @@ var MarkupKind;
|
|
|
828
559
|
var MarkupContent;
|
|
829
560
|
(function(MarkupContent2) {
|
|
830
561
|
function is(value) {
|
|
831
|
-
|
|
562
|
+
const candidate = value;
|
|
832
563
|
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
|
|
833
564
|
}
|
|
834
565
|
MarkupContent2.is = is;
|
|
@@ -877,7 +608,7 @@ var InsertReplaceEdit;
|
|
|
877
608
|
}
|
|
878
609
|
InsertReplaceEdit2.create = create;
|
|
879
610
|
function is(value) {
|
|
880
|
-
|
|
611
|
+
const candidate = value;
|
|
881
612
|
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
|
|
882
613
|
}
|
|
883
614
|
InsertReplaceEdit2.is = is;
|
|
@@ -887,6 +618,14 @@ var InsertTextMode;
|
|
|
887
618
|
InsertTextMode2.asIs = 1;
|
|
888
619
|
InsertTextMode2.adjustIndentation = 2;
|
|
889
620
|
})(InsertTextMode || (InsertTextMode = {}));
|
|
621
|
+
var CompletionItemLabelDetails;
|
|
622
|
+
(function(CompletionItemLabelDetails2) {
|
|
623
|
+
function is(value) {
|
|
624
|
+
const candidate = value;
|
|
625
|
+
return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
|
|
626
|
+
}
|
|
627
|
+
CompletionItemLabelDetails2.is = is;
|
|
628
|
+
})(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));
|
|
890
629
|
var CompletionItem;
|
|
891
630
|
(function(CompletionItem2) {
|
|
892
631
|
function create(label) {
|
|
@@ -908,7 +647,7 @@ var MarkedString;
|
|
|
908
647
|
}
|
|
909
648
|
MarkedString2.fromPlainText = fromPlainText;
|
|
910
649
|
function is(value) {
|
|
911
|
-
|
|
650
|
+
const candidate = value;
|
|
912
651
|
return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
|
|
913
652
|
}
|
|
914
653
|
MarkedString2.is = is;
|
|
@@ -916,7 +655,7 @@ var MarkedString;
|
|
|
916
655
|
var Hover;
|
|
917
656
|
(function(Hover2) {
|
|
918
657
|
function is(value) {
|
|
919
|
-
|
|
658
|
+
let candidate = value;
|
|
920
659
|
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));
|
|
921
660
|
}
|
|
922
661
|
Hover2.is = is;
|
|
@@ -930,12 +669,8 @@ var ParameterInformation;
|
|
|
930
669
|
})(ParameterInformation || (ParameterInformation = {}));
|
|
931
670
|
var SignatureInformation;
|
|
932
671
|
(function(SignatureInformation2) {
|
|
933
|
-
function create(label, documentation) {
|
|
934
|
-
|
|
935
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
936
|
-
parameters[_i - 2] = arguments[_i];
|
|
937
|
-
}
|
|
938
|
-
var result = { label };
|
|
672
|
+
function create(label, documentation, ...parameters) {
|
|
673
|
+
let result = { label };
|
|
939
674
|
if (Is.defined(documentation)) {
|
|
940
675
|
result.documentation = documentation;
|
|
941
676
|
}
|
|
@@ -957,7 +692,7 @@ var DocumentHighlightKind;
|
|
|
957
692
|
var DocumentHighlight;
|
|
958
693
|
(function(DocumentHighlight2) {
|
|
959
694
|
function create(range, kind) {
|
|
960
|
-
|
|
695
|
+
let result = { range };
|
|
961
696
|
if (Is.number(kind)) {
|
|
962
697
|
result.kind = kind;
|
|
963
698
|
}
|
|
@@ -1001,7 +736,7 @@ var SymbolTag;
|
|
|
1001
736
|
var SymbolInformation;
|
|
1002
737
|
(function(SymbolInformation2) {
|
|
1003
738
|
function create(name, kind, range, uri, containerName) {
|
|
1004
|
-
|
|
739
|
+
let result = {
|
|
1005
740
|
name,
|
|
1006
741
|
kind,
|
|
1007
742
|
location: { uri, range }
|
|
@@ -1013,10 +748,17 @@ var SymbolInformation;
|
|
|
1013
748
|
}
|
|
1014
749
|
SymbolInformation2.create = create;
|
|
1015
750
|
})(SymbolInformation || (SymbolInformation = {}));
|
|
751
|
+
var WorkspaceSymbol;
|
|
752
|
+
(function(WorkspaceSymbol2) {
|
|
753
|
+
function create(name, kind, uri, range) {
|
|
754
|
+
return range !== void 0 ? { name, kind, location: { uri, range } } : { name, kind, location: { uri } };
|
|
755
|
+
}
|
|
756
|
+
WorkspaceSymbol2.create = create;
|
|
757
|
+
})(WorkspaceSymbol || (WorkspaceSymbol = {}));
|
|
1016
758
|
var DocumentSymbol;
|
|
1017
759
|
(function(DocumentSymbol2) {
|
|
1018
760
|
function create(name, detail, kind, range, selectionRange, children) {
|
|
1019
|
-
|
|
761
|
+
let result = {
|
|
1020
762
|
name,
|
|
1021
763
|
detail,
|
|
1022
764
|
kind,
|
|
@@ -1030,7 +772,7 @@ var DocumentSymbol;
|
|
|
1030
772
|
}
|
|
1031
773
|
DocumentSymbol2.create = create;
|
|
1032
774
|
function is(value) {
|
|
1033
|
-
|
|
775
|
+
let candidate = value;
|
|
1034
776
|
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));
|
|
1035
777
|
}
|
|
1036
778
|
DocumentSymbol2.is = is;
|
|
@@ -1047,27 +789,35 @@ var CodeActionKind;
|
|
|
1047
789
|
CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
|
|
1048
790
|
CodeActionKind2.SourceFixAll = "source.fixAll";
|
|
1049
791
|
})(CodeActionKind || (CodeActionKind = {}));
|
|
792
|
+
var CodeActionTriggerKind;
|
|
793
|
+
(function(CodeActionTriggerKind2) {
|
|
794
|
+
CodeActionTriggerKind2.Invoked = 1;
|
|
795
|
+
CodeActionTriggerKind2.Automatic = 2;
|
|
796
|
+
})(CodeActionTriggerKind || (CodeActionTriggerKind = {}));
|
|
1050
797
|
var CodeActionContext;
|
|
1051
798
|
(function(CodeActionContext2) {
|
|
1052
|
-
function create(diagnostics, only) {
|
|
1053
|
-
|
|
799
|
+
function create(diagnostics, only, triggerKind) {
|
|
800
|
+
let result = { diagnostics };
|
|
1054
801
|
if (only !== void 0 && only !== null) {
|
|
1055
802
|
result.only = only;
|
|
1056
803
|
}
|
|
804
|
+
if (triggerKind !== void 0 && triggerKind !== null) {
|
|
805
|
+
result.triggerKind = triggerKind;
|
|
806
|
+
}
|
|
1057
807
|
return result;
|
|
1058
808
|
}
|
|
1059
809
|
CodeActionContext2.create = create;
|
|
1060
810
|
function is(value) {
|
|
1061
|
-
|
|
1062
|
-
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
|
|
811
|
+
let candidate = value;
|
|
812
|
+
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);
|
|
1063
813
|
}
|
|
1064
814
|
CodeActionContext2.is = is;
|
|
1065
815
|
})(CodeActionContext || (CodeActionContext = {}));
|
|
1066
816
|
var CodeAction;
|
|
1067
817
|
(function(CodeAction2) {
|
|
1068
818
|
function create(title, kindOrCommandOrEdit, kind) {
|
|
1069
|
-
|
|
1070
|
-
|
|
819
|
+
let result = { title };
|
|
820
|
+
let checkKind = true;
|
|
1071
821
|
if (typeof kindOrCommandOrEdit === "string") {
|
|
1072
822
|
checkKind = false;
|
|
1073
823
|
result.kind = kindOrCommandOrEdit;
|
|
@@ -1083,7 +833,7 @@ var CodeAction;
|
|
|
1083
833
|
}
|
|
1084
834
|
CodeAction2.create = create;
|
|
1085
835
|
function is(value) {
|
|
1086
|
-
|
|
836
|
+
let candidate = value;
|
|
1087
837
|
return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.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));
|
|
1088
838
|
}
|
|
1089
839
|
CodeAction2.is = is;
|
|
@@ -1091,7 +841,7 @@ var CodeAction;
|
|
|
1091
841
|
var CodeLens;
|
|
1092
842
|
(function(CodeLens2) {
|
|
1093
843
|
function create(range, data) {
|
|
1094
|
-
|
|
844
|
+
let result = { range };
|
|
1095
845
|
if (Is.defined(data)) {
|
|
1096
846
|
result.data = data;
|
|
1097
847
|
}
|
|
@@ -1099,7 +849,7 @@ var CodeLens;
|
|
|
1099
849
|
}
|
|
1100
850
|
CodeLens2.create = create;
|
|
1101
851
|
function is(value) {
|
|
1102
|
-
|
|
852
|
+
let candidate = value;
|
|
1103
853
|
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
|
|
1104
854
|
}
|
|
1105
855
|
CodeLens2.is = is;
|
|
@@ -1111,7 +861,7 @@ var FormattingOptions;
|
|
|
1111
861
|
}
|
|
1112
862
|
FormattingOptions2.create = create;
|
|
1113
863
|
function is(value) {
|
|
1114
|
-
|
|
864
|
+
let candidate = value;
|
|
1115
865
|
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
|
|
1116
866
|
}
|
|
1117
867
|
FormattingOptions2.is = is;
|
|
@@ -1123,7 +873,7 @@ var DocumentLink;
|
|
|
1123
873
|
}
|
|
1124
874
|
DocumentLink2.create = create;
|
|
1125
875
|
function is(value) {
|
|
1126
|
-
|
|
876
|
+
let candidate = value;
|
|
1127
877
|
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
|
|
1128
878
|
}
|
|
1129
879
|
DocumentLink2.is = is;
|
|
@@ -1135,11 +885,191 @@ var SelectionRange;
|
|
|
1135
885
|
}
|
|
1136
886
|
SelectionRange2.create = create;
|
|
1137
887
|
function is(value) {
|
|
1138
|
-
|
|
1139
|
-
return candidate
|
|
888
|
+
let candidate = value;
|
|
889
|
+
return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
|
|
1140
890
|
}
|
|
1141
891
|
SelectionRange2.is = is;
|
|
1142
892
|
})(SelectionRange || (SelectionRange = {}));
|
|
893
|
+
var SemanticTokenTypes;
|
|
894
|
+
(function(SemanticTokenTypes2) {
|
|
895
|
+
SemanticTokenTypes2["namespace"] = "namespace";
|
|
896
|
+
SemanticTokenTypes2["type"] = "type";
|
|
897
|
+
SemanticTokenTypes2["class"] = "class";
|
|
898
|
+
SemanticTokenTypes2["enum"] = "enum";
|
|
899
|
+
SemanticTokenTypes2["interface"] = "interface";
|
|
900
|
+
SemanticTokenTypes2["struct"] = "struct";
|
|
901
|
+
SemanticTokenTypes2["typeParameter"] = "typeParameter";
|
|
902
|
+
SemanticTokenTypes2["parameter"] = "parameter";
|
|
903
|
+
SemanticTokenTypes2["variable"] = "variable";
|
|
904
|
+
SemanticTokenTypes2["property"] = "property";
|
|
905
|
+
SemanticTokenTypes2["enumMember"] = "enumMember";
|
|
906
|
+
SemanticTokenTypes2["event"] = "event";
|
|
907
|
+
SemanticTokenTypes2["function"] = "function";
|
|
908
|
+
SemanticTokenTypes2["method"] = "method";
|
|
909
|
+
SemanticTokenTypes2["macro"] = "macro";
|
|
910
|
+
SemanticTokenTypes2["keyword"] = "keyword";
|
|
911
|
+
SemanticTokenTypes2["modifier"] = "modifier";
|
|
912
|
+
SemanticTokenTypes2["comment"] = "comment";
|
|
913
|
+
SemanticTokenTypes2["string"] = "string";
|
|
914
|
+
SemanticTokenTypes2["number"] = "number";
|
|
915
|
+
SemanticTokenTypes2["regexp"] = "regexp";
|
|
916
|
+
SemanticTokenTypes2["operator"] = "operator";
|
|
917
|
+
SemanticTokenTypes2["decorator"] = "decorator";
|
|
918
|
+
})(SemanticTokenTypes || (SemanticTokenTypes = {}));
|
|
919
|
+
var SemanticTokenModifiers;
|
|
920
|
+
(function(SemanticTokenModifiers2) {
|
|
921
|
+
SemanticTokenModifiers2["declaration"] = "declaration";
|
|
922
|
+
SemanticTokenModifiers2["definition"] = "definition";
|
|
923
|
+
SemanticTokenModifiers2["readonly"] = "readonly";
|
|
924
|
+
SemanticTokenModifiers2["static"] = "static";
|
|
925
|
+
SemanticTokenModifiers2["deprecated"] = "deprecated";
|
|
926
|
+
SemanticTokenModifiers2["abstract"] = "abstract";
|
|
927
|
+
SemanticTokenModifiers2["async"] = "async";
|
|
928
|
+
SemanticTokenModifiers2["modification"] = "modification";
|
|
929
|
+
SemanticTokenModifiers2["documentation"] = "documentation";
|
|
930
|
+
SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
|
|
931
|
+
})(SemanticTokenModifiers || (SemanticTokenModifiers = {}));
|
|
932
|
+
var SemanticTokens;
|
|
933
|
+
(function(SemanticTokens2) {
|
|
934
|
+
function is(value) {
|
|
935
|
+
const candidate = value;
|
|
936
|
+
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");
|
|
937
|
+
}
|
|
938
|
+
SemanticTokens2.is = is;
|
|
939
|
+
})(SemanticTokens || (SemanticTokens = {}));
|
|
940
|
+
var InlineValueText;
|
|
941
|
+
(function(InlineValueText2) {
|
|
942
|
+
function create(range, text) {
|
|
943
|
+
return { range, text };
|
|
944
|
+
}
|
|
945
|
+
InlineValueText2.create = create;
|
|
946
|
+
function is(value) {
|
|
947
|
+
const candidate = value;
|
|
948
|
+
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);
|
|
949
|
+
}
|
|
950
|
+
InlineValueText2.is = is;
|
|
951
|
+
})(InlineValueText || (InlineValueText = {}));
|
|
952
|
+
var InlineValueVariableLookup;
|
|
953
|
+
(function(InlineValueVariableLookup2) {
|
|
954
|
+
function create(range, variableName, caseSensitiveLookup) {
|
|
955
|
+
return { range, variableName, caseSensitiveLookup };
|
|
956
|
+
}
|
|
957
|
+
InlineValueVariableLookup2.create = create;
|
|
958
|
+
function is(value) {
|
|
959
|
+
const candidate = value;
|
|
960
|
+
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0);
|
|
961
|
+
}
|
|
962
|
+
InlineValueVariableLookup2.is = is;
|
|
963
|
+
})(InlineValueVariableLookup || (InlineValueVariableLookup = {}));
|
|
964
|
+
var InlineValueEvaluatableExpression;
|
|
965
|
+
(function(InlineValueEvaluatableExpression2) {
|
|
966
|
+
function create(range, expression) {
|
|
967
|
+
return { range, expression };
|
|
968
|
+
}
|
|
969
|
+
InlineValueEvaluatableExpression2.create = create;
|
|
970
|
+
function is(value) {
|
|
971
|
+
const candidate = value;
|
|
972
|
+
return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0);
|
|
973
|
+
}
|
|
974
|
+
InlineValueEvaluatableExpression2.is = is;
|
|
975
|
+
})(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));
|
|
976
|
+
var InlineValueContext;
|
|
977
|
+
(function(InlineValueContext2) {
|
|
978
|
+
function create(frameId, stoppedLocation) {
|
|
979
|
+
return { frameId, stoppedLocation };
|
|
980
|
+
}
|
|
981
|
+
InlineValueContext2.create = create;
|
|
982
|
+
function is(value) {
|
|
983
|
+
const candidate = value;
|
|
984
|
+
return Is.defined(candidate) && Range.is(value.stoppedLocation);
|
|
985
|
+
}
|
|
986
|
+
InlineValueContext2.is = is;
|
|
987
|
+
})(InlineValueContext || (InlineValueContext = {}));
|
|
988
|
+
var InlayHintKind;
|
|
989
|
+
(function(InlayHintKind2) {
|
|
990
|
+
InlayHintKind2.Type = 1;
|
|
991
|
+
InlayHintKind2.Parameter = 2;
|
|
992
|
+
function is(value) {
|
|
993
|
+
return value === 1 || value === 2;
|
|
994
|
+
}
|
|
995
|
+
InlayHintKind2.is = is;
|
|
996
|
+
})(InlayHintKind || (InlayHintKind = {}));
|
|
997
|
+
var InlayHintLabelPart;
|
|
998
|
+
(function(InlayHintLabelPart2) {
|
|
999
|
+
function create(value) {
|
|
1000
|
+
return { value };
|
|
1001
|
+
}
|
|
1002
|
+
InlayHintLabelPart2.create = create;
|
|
1003
|
+
function is(value) {
|
|
1004
|
+
const candidate = value;
|
|
1005
|
+
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));
|
|
1006
|
+
}
|
|
1007
|
+
InlayHintLabelPart2.is = is;
|
|
1008
|
+
})(InlayHintLabelPart || (InlayHintLabelPart = {}));
|
|
1009
|
+
var InlayHint;
|
|
1010
|
+
(function(InlayHint2) {
|
|
1011
|
+
function create(position, label, kind) {
|
|
1012
|
+
const result = { position, label };
|
|
1013
|
+
if (kind !== void 0) {
|
|
1014
|
+
result.kind = kind;
|
|
1015
|
+
}
|
|
1016
|
+
return result;
|
|
1017
|
+
}
|
|
1018
|
+
InlayHint2.create = create;
|
|
1019
|
+
function is(value) {
|
|
1020
|
+
const candidate = value;
|
|
1021
|
+
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));
|
|
1022
|
+
}
|
|
1023
|
+
InlayHint2.is = is;
|
|
1024
|
+
})(InlayHint || (InlayHint = {}));
|
|
1025
|
+
var StringValue;
|
|
1026
|
+
(function(StringValue2) {
|
|
1027
|
+
function createSnippet(value) {
|
|
1028
|
+
return { kind: "snippet", value };
|
|
1029
|
+
}
|
|
1030
|
+
StringValue2.createSnippet = createSnippet;
|
|
1031
|
+
})(StringValue || (StringValue = {}));
|
|
1032
|
+
var InlineCompletionItem;
|
|
1033
|
+
(function(InlineCompletionItem2) {
|
|
1034
|
+
function create(insertText, filterText, range, command) {
|
|
1035
|
+
return { insertText, filterText, range, command };
|
|
1036
|
+
}
|
|
1037
|
+
InlineCompletionItem2.create = create;
|
|
1038
|
+
})(InlineCompletionItem || (InlineCompletionItem = {}));
|
|
1039
|
+
var InlineCompletionList;
|
|
1040
|
+
(function(InlineCompletionList2) {
|
|
1041
|
+
function create(items) {
|
|
1042
|
+
return { items };
|
|
1043
|
+
}
|
|
1044
|
+
InlineCompletionList2.create = create;
|
|
1045
|
+
})(InlineCompletionList || (InlineCompletionList = {}));
|
|
1046
|
+
var InlineCompletionTriggerKind;
|
|
1047
|
+
(function(InlineCompletionTriggerKind2) {
|
|
1048
|
+
InlineCompletionTriggerKind2.Invoked = 0;
|
|
1049
|
+
InlineCompletionTriggerKind2.Automatic = 1;
|
|
1050
|
+
})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
|
|
1051
|
+
var SelectedCompletionInfo;
|
|
1052
|
+
(function(SelectedCompletionInfo2) {
|
|
1053
|
+
function create(range, text) {
|
|
1054
|
+
return { range, text };
|
|
1055
|
+
}
|
|
1056
|
+
SelectedCompletionInfo2.create = create;
|
|
1057
|
+
})(SelectedCompletionInfo || (SelectedCompletionInfo = {}));
|
|
1058
|
+
var InlineCompletionContext;
|
|
1059
|
+
(function(InlineCompletionContext2) {
|
|
1060
|
+
function create(triggerKind, selectedCompletionInfo) {
|
|
1061
|
+
return { triggerKind, selectedCompletionInfo };
|
|
1062
|
+
}
|
|
1063
|
+
InlineCompletionContext2.create = create;
|
|
1064
|
+
})(InlineCompletionContext || (InlineCompletionContext = {}));
|
|
1065
|
+
var WorkspaceFolder;
|
|
1066
|
+
(function(WorkspaceFolder2) {
|
|
1067
|
+
function is(value) {
|
|
1068
|
+
const candidate = value;
|
|
1069
|
+
return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);
|
|
1070
|
+
}
|
|
1071
|
+
WorkspaceFolder2.is = is;
|
|
1072
|
+
})(WorkspaceFolder || (WorkspaceFolder = {}));
|
|
1143
1073
|
var TextDocument;
|
|
1144
1074
|
(function(TextDocument2) {
|
|
1145
1075
|
function create(uri, languageId, version, content) {
|
|
@@ -1147,24 +1077,24 @@ var TextDocument;
|
|
|
1147
1077
|
}
|
|
1148
1078
|
TextDocument2.create = create;
|
|
1149
1079
|
function is(value) {
|
|
1150
|
-
|
|
1080
|
+
let candidate = value;
|
|
1151
1081
|
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;
|
|
1152
1082
|
}
|
|
1153
1083
|
TextDocument2.is = is;
|
|
1154
1084
|
function applyEdits(document, edits) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1085
|
+
let text = document.getText();
|
|
1086
|
+
let sortedEdits = mergeSort(edits, (a, b) => {
|
|
1087
|
+
let diff = a.range.start.line - b.range.start.line;
|
|
1158
1088
|
if (diff === 0) {
|
|
1159
1089
|
return a.range.start.character - b.range.start.character;
|
|
1160
1090
|
}
|
|
1161
1091
|
return diff;
|
|
1162
1092
|
});
|
|
1163
|
-
|
|
1164
|
-
for (
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1093
|
+
let lastModifiedOffset = text.length;
|
|
1094
|
+
for (let i = sortedEdits.length - 1; i >= 0; i--) {
|
|
1095
|
+
let e = sortedEdits[i];
|
|
1096
|
+
let startOffset = document.offsetAt(e.range.start);
|
|
1097
|
+
let endOffset = document.offsetAt(e.range.end);
|
|
1168
1098
|
if (endOffset <= lastModifiedOffset) {
|
|
1169
1099
|
text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
|
|
1170
1100
|
} else {
|
|
@@ -1179,16 +1109,16 @@ var TextDocument;
|
|
|
1179
1109
|
if (data.length <= 1) {
|
|
1180
1110
|
return data;
|
|
1181
1111
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1112
|
+
const p = data.length / 2 | 0;
|
|
1113
|
+
const left = data.slice(0, p);
|
|
1114
|
+
const right = data.slice(p);
|
|
1185
1115
|
mergeSort(left, compare);
|
|
1186
1116
|
mergeSort(right, compare);
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1117
|
+
let leftIdx = 0;
|
|
1118
|
+
let rightIdx = 0;
|
|
1119
|
+
let i = 0;
|
|
1190
1120
|
while (leftIdx < left.length && rightIdx < right.length) {
|
|
1191
|
-
|
|
1121
|
+
let ret = compare(left[leftIdx], right[rightIdx]);
|
|
1192
1122
|
if (ret <= 0) {
|
|
1193
1123
|
data[i++] = left[leftIdx++];
|
|
1194
1124
|
} else {
|
|
@@ -1204,115 +1134,95 @@ var TextDocument;
|
|
|
1204
1134
|
return data;
|
|
1205
1135
|
}
|
|
1206
1136
|
})(TextDocument || (TextDocument = {}));
|
|
1207
|
-
var FullTextDocument =
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1137
|
+
var FullTextDocument = class {
|
|
1138
|
+
constructor(uri, languageId, version, content) {
|
|
1139
|
+
this._uri = uri;
|
|
1140
|
+
this._languageId = languageId;
|
|
1141
|
+
this._version = version;
|
|
1142
|
+
this._content = content;
|
|
1143
|
+
this._lineOffsets = void 0;
|
|
1144
|
+
}
|
|
1145
|
+
get uri() {
|
|
1146
|
+
return this._uri;
|
|
1147
|
+
}
|
|
1148
|
+
get languageId() {
|
|
1149
|
+
return this._languageId;
|
|
1150
|
+
}
|
|
1151
|
+
get version() {
|
|
1152
|
+
return this._version;
|
|
1153
|
+
}
|
|
1154
|
+
getText(range) {
|
|
1155
|
+
if (range) {
|
|
1156
|
+
let start = this.offsetAt(range.start);
|
|
1157
|
+
let end = this.offsetAt(range.end);
|
|
1158
|
+
return this._content.substring(start, end);
|
|
1216
1159
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
return this._version;
|
|
1234
|
-
},
|
|
1235
|
-
enumerable: false,
|
|
1236
|
-
configurable: true
|
|
1237
|
-
});
|
|
1238
|
-
FullTextDocument2.prototype.getText = function(range) {
|
|
1239
|
-
if (range) {
|
|
1240
|
-
var start = this.offsetAt(range.start);
|
|
1241
|
-
var end = this.offsetAt(range.end);
|
|
1242
|
-
return this._content.substring(start, end);
|
|
1243
|
-
}
|
|
1244
|
-
return this._content;
|
|
1245
|
-
};
|
|
1246
|
-
FullTextDocument2.prototype.update = function(event, version) {
|
|
1247
|
-
this._content = event.text;
|
|
1248
|
-
this._version = version;
|
|
1249
|
-
this._lineOffsets = void 0;
|
|
1250
|
-
};
|
|
1251
|
-
FullTextDocument2.prototype.getLineOffsets = function() {
|
|
1252
|
-
if (this._lineOffsets === void 0) {
|
|
1253
|
-
var lineOffsets = [];
|
|
1254
|
-
var text = this._content;
|
|
1255
|
-
var isLineStart = true;
|
|
1256
|
-
for (var i = 0; i < text.length; i++) {
|
|
1257
|
-
if (isLineStart) {
|
|
1258
|
-
lineOffsets.push(i);
|
|
1259
|
-
isLineStart = false;
|
|
1260
|
-
}
|
|
1261
|
-
var ch = text.charAt(i);
|
|
1262
|
-
isLineStart = ch === "\r" || ch === "\n";
|
|
1263
|
-
if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
|
|
1264
|
-
i++;
|
|
1265
|
-
}
|
|
1160
|
+
return this._content;
|
|
1161
|
+
}
|
|
1162
|
+
update(event, version) {
|
|
1163
|
+
this._content = event.text;
|
|
1164
|
+
this._version = version;
|
|
1165
|
+
this._lineOffsets = void 0;
|
|
1166
|
+
}
|
|
1167
|
+
getLineOffsets() {
|
|
1168
|
+
if (this._lineOffsets === void 0) {
|
|
1169
|
+
let lineOffsets = [];
|
|
1170
|
+
let text = this._content;
|
|
1171
|
+
let isLineStart = true;
|
|
1172
|
+
for (let i = 0; i < text.length; i++) {
|
|
1173
|
+
if (isLineStart) {
|
|
1174
|
+
lineOffsets.push(i);
|
|
1175
|
+
isLineStart = false;
|
|
1266
1176
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1177
|
+
let ch = text.charAt(i);
|
|
1178
|
+
isLineStart = ch === "\r" || ch === "\n";
|
|
1179
|
+
if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
|
|
1180
|
+
i++;
|
|
1269
1181
|
}
|
|
1270
|
-
this._lineOffsets = lineOffsets;
|
|
1271
|
-
}
|
|
1272
|
-
return this._lineOffsets;
|
|
1273
|
-
};
|
|
1274
|
-
FullTextDocument2.prototype.positionAt = function(offset) {
|
|
1275
|
-
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
1276
|
-
var lineOffsets = this.getLineOffsets();
|
|
1277
|
-
var low = 0, high = lineOffsets.length;
|
|
1278
|
-
if (high === 0) {
|
|
1279
|
-
return Position.create(0, offset);
|
|
1280
1182
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
if (lineOffsets[mid] > offset) {
|
|
1284
|
-
high = mid;
|
|
1285
|
-
} else {
|
|
1286
|
-
low = mid + 1;
|
|
1287
|
-
}
|
|
1183
|
+
if (isLineStart && text.length > 0) {
|
|
1184
|
+
lineOffsets.push(text.length);
|
|
1288
1185
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1186
|
+
this._lineOffsets = lineOffsets;
|
|
1187
|
+
}
|
|
1188
|
+
return this._lineOffsets;
|
|
1189
|
+
}
|
|
1190
|
+
positionAt(offset) {
|
|
1191
|
+
offset = Math.max(Math.min(offset, this._content.length), 0);
|
|
1192
|
+
let lineOffsets = this.getLineOffsets();
|
|
1193
|
+
let low = 0, high = lineOffsets.length;
|
|
1194
|
+
if (high === 0) {
|
|
1195
|
+
return Position.create(0, offset);
|
|
1196
|
+
}
|
|
1197
|
+
while (low < high) {
|
|
1198
|
+
let mid = Math.floor((low + high) / 2);
|
|
1199
|
+
if (lineOffsets[mid] > offset) {
|
|
1200
|
+
high = mid;
|
|
1201
|
+
} else {
|
|
1202
|
+
low = mid + 1;
|
|
1298
1203
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
);
|
|
1204
|
+
}
|
|
1205
|
+
let line = low - 1;
|
|
1206
|
+
return Position.create(line, offset - lineOffsets[line]);
|
|
1207
|
+
}
|
|
1208
|
+
offsetAt(position) {
|
|
1209
|
+
let lineOffsets = this.getLineOffsets();
|
|
1210
|
+
if (position.line >= lineOffsets.length) {
|
|
1211
|
+
return this._content.length;
|
|
1212
|
+
} else if (position.line < 0) {
|
|
1213
|
+
return 0;
|
|
1214
|
+
}
|
|
1215
|
+
let lineOffset = lineOffsets[position.line];
|
|
1216
|
+
let nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
|
|
1217
|
+
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
|
|
1218
|
+
}
|
|
1219
|
+
get lineCount() {
|
|
1220
|
+
return this.getLineOffsets().length;
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1313
1223
|
var Is;
|
|
1314
1224
|
(function(Is2) {
|
|
1315
|
-
|
|
1225
|
+
const toString = Object.prototype.toString;
|
|
1316
1226
|
function defined(value) {
|
|
1317
1227
|
return typeof value !== "undefined";
|
|
1318
1228
|
}
|