monaco-editor-core 0.56.0-dev-20260204 → 0.56.0-dev-20260205

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.
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -1,6 +1,6 @@
1
1
  /*!-----------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Version: 0.56.0-dev-20260204(613524bdf43891f71ce0bf1f99584b666d70c95a)
3
+ * Version: 0.56.0-dev-20260205(613524bdf43891f71ce0bf1f99584b666d70c95a)
4
4
  * Released under the MIT license
5
5
  * https://github.com/microsoft/vscode/blob/main/LICENSE.txt
6
6
  *-----------------------------------------------------------*/
@@ -44,6 +44,11 @@ export class AnnotatedString {
44
44
  let startIndex;
45
45
  if (startIndexWhereToReplace >= 0) {
46
46
  startIndex = startIndexWhereToReplace;
47
+ // Also include the next annotation if it ends exactly at offset (touching boundary)
48
+ const nextCandidate = this._annotations[startIndex]?.range;
49
+ if (nextCandidate && nextCandidate.endExclusive === offset) {
50
+ startIndex--;
51
+ }
47
52
  }
48
53
  else {
49
54
  const candidate = this._annotations[-(startIndexWhereToReplace + 2)]?.range;
@@ -64,10 +69,15 @@ export class AnnotatedString {
64
69
  let endIndexExclusive;
65
70
  if (endIndexWhereToReplace >= 0) {
66
71
  endIndexExclusive = endIndexWhereToReplace + 1;
72
+ // Also include the next annotation if it starts exactly at offset (touching boundary)
73
+ const nextCandidate = this._annotations[endIndexExclusive]?.range;
74
+ if (nextCandidate && nextCandidate.start === offset) {
75
+ endIndexExclusive++;
76
+ }
67
77
  }
68
78
  else {
69
79
  const candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;
70
- if (candidate && offset > candidate.start && offset <= candidate.endExclusive) {
80
+ if (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {
71
81
  endIndexExclusive = -endIndexWhereToReplace;
72
82
  }
73
83
  else {
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/annotations.ts","vs/editor/common/model/tokens/annotations.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AA0BlE,MAAM,OAAO,eAAe;IAO3B,YAAY,cAAgC,EAAE;QAL9C;;WAEG;QACK,iBAAY,GAAqB,EAAE,CAAC;QAG3C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,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CAAI,WAAmC;QAC1D,OAAO,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAID,YAAoB,WAAmC;QACtD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD","file":"annotations.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset < candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset > candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset < candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset > candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/annotations.ts","vs/editor/common/model/tokens/annotations.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AA0BlE,MAAM,OAAO,eAAe;IAO3B,YAAY,cAAgC,EAAE;QAL9C;;WAEG;QACK,iBAAY,GAAqB,EAAE,CAAC;QAG3C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,WAAiC;QACtD,KAAK,MAAM,UAAU,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;YAClD,MAAM,UAAU,GAAG,IAAI,CAAC,sCAAsC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvF,MAAM,iBAAiB,GAAG,IAAI,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AkB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACrC,OAAO,kBAAkB,CAAC;IAC3B,CAAC;CACD;AAOD,MAAM,OAAO,iBAAiB;IAEtB,MAAM,CAAC,MAAM,CAAI,WAAmC;QAC1D,OAAO,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAID,YAAoB,WAAmC;QACtD,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD","file":"annotations.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t\t// Also include the next annotation if it ends exactly at offset (touching boundary)\n\t\t\tconst nextCandidate = this._annotations[startIndex]?.range;\n\t\t\tif (nextCandidate && nextCandidate.endExclusive === offset) {\n\t\t\t\tstartIndex--;\n\t\t\t}\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset < candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t\t// Also include the next annotation if it starts exactly at offset (touching boundary)\n\t\t\tconst nextCandidate = this._annotations[endIndexExclusive]?.range;\n\t\t\tif (nextCandidate && nextCandidate.start === offset) {\n\t\t\t\tendIndexExclusive++;\n\t\t\t}\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t\t// Also include the next annotation if it ends exactly at offset (touching boundary)\n\t\t\tconst nextCandidate = this._annotations[startIndex]?.range;\n\t\t\tif (nextCandidate && nextCandidate.endExclusive === offset) {\n\t\t\t\tstartIndex--;\n\t\t\t}\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset < candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t\t// Also include the next annotation if it starts exactly at offset (touching boundary)\n\t\t\tconst nextCandidate = this._annotations[endIndexExclusive]?.range;\n\t\t\tif (nextCandidate && nextCandidate.start === offset) {\n\t\t\t\tendIndexExclusive++;\n\t\t\t}\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "monaco-editor-core",
3
3
  "private": false,
4
- "version": "0.56.0-dev-20260204",
4
+ "version": "0.56.0-dev-20260205",
5
5
  "description": "A browser based code editor",
6
6
  "author": "Microsoft Corporation",
7
7
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "bugs": {
15
15
  "url": "https://github.com/microsoft/vscode/issues"
16
16
  },
17
- "vscodeCommitId": "d3dbc037c04a68ab8866928b7c6f9ecfe6eedb0f",
17
+ "vscodeCommitId": "974f2037e269a93f82f7cfa02279d2fba954fb58",
18
18
  "dependencies": {
19
19
  "marked": "14.0.0",
20
20
  "dompurify": "3.2.7"