monaco-editor-core 0.56.0-dev-20260116 → 0.56.0-dev-20260117
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/esm/nls.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/editor/common/model/tokens/annotations.js +2 -2
- package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +0 -5
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +4 -0
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +7 -5
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +5 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/platform/actions/common/actions.js +1 -0
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/package.json +2 -2
package/esm/nls.messages.cs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.de.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.fr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.it.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ja.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ko.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.pl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
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-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.ru.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
package/esm/nls.messages.tr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!-----------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Version: 0.56.0-dev-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
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-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
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-
|
|
3
|
+
* Version: 0.56.0-dev-20260117(3f26219a3c6e5b21b6b5725327da71fbf25fbf12)
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/microsoft/vscode/blob/main/LICENSE.txt
|
|
6
6
|
*-----------------------------------------------------------*/
|
|
@@ -47,7 +47,7 @@ export class AnnotatedString {
|
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
const candidate = this._annotations[-(startIndexWhereToReplace + 2)]?.range;
|
|
50
|
-
if (candidate && offset >= candidate.start && offset
|
|
50
|
+
if (candidate && offset >= candidate.start && offset < candidate.endExclusive) {
|
|
51
51
|
startIndex = -(startIndexWhereToReplace + 2);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
@@ -67,7 +67,7 @@ export class AnnotatedString {
|
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
const candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;
|
|
70
|
-
if (candidate && offset
|
|
70
|
+
if (candidate && offset > candidate.start && offset <= candidate.endExclusive) {
|
|
71
71
|
endIndexExclusive = -endIndexWhereToReplace;
|
|
72
72
|
}
|
|
73
73
|
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,CAA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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,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AAI,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"]}
|
|
@@ -29,11 +29,6 @@ export class TokenizationFontDecorationProvider extends Disposable {
|
|
|
29
29
|
const affectedLineFonts = new Set();
|
|
30
30
|
for (const annotation of fontChanges.changes.annotations) {
|
|
31
31
|
const startPosition = this.textModel.getPositionAt(annotation.range.start);
|
|
32
|
-
const endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);
|
|
33
|
-
if (startPosition.lineNumber !== endPosition.lineNumber) {
|
|
34
|
-
// The token should be always on a single line
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
32
|
const lineNumber = startPosition.lineNumber;
|
|
38
33
|
let fontTokenAnnotation;
|
|
39
34
|
if (annotation.annotation === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts","vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAsB,0BAA0B,EAAE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K,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,EACjD,OAAO,EACP,mBAAmB,CACnB,CAAC;IACH,CAAC","file":"tokenizationFontDecorationsProvider.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 { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\n\t\t\t\tif (startPosition.lineNumber !== endPosition.lineNumber) {\n\t\t\t\t\t// The token should be always on a single line\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeightMultiplier) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeightMultiplier));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSizeMultiplier);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\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 { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\n\t\t\t\tif (startPosition.lineNumber !== endPosition.lineNumber) {\n\t\t\t\t\t// The token should be always on a single line\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeightMultiplier) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeightMultiplier));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSizeMultiplier);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts","vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAsB,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxH,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAuC,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAOzE,MAAM,OAAO,kCAAmC,SAAQ,UAAU;aAElD,qBAAgB,GAAG,CAAH,AAAI,CAAC;IAUpC,YACkB,SAAqB,EACrB,yBAAoD;QAErE,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,8BAAyB,GAAzB,yBAAyB,CAA2B;QAVrD,2BAAsB,GAAG,IAAI,OAAO,EAAqC,CAAC;QAC3E,0BAAqB,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC;QAEzD,qBAAgB,GAAG,IAAI,OAAO,EAA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AChB,EAAE,EAAE,EAAE;gBACN,OAAO,EAAE;oBACR,WAAW,EAAE,sBAAsB;oBACnC,eAAe,EAAE,SAAS;oBAC1B,WAAW;iBACX;gBACD,OAAO,EAAE,CAAC;gBACV,KAAK;aACL,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC;IAEM,iBAAiB,CAAC,OAAgB,EAAE,mBAA6B;QACvE,OAAO,IAAI,CAAC,qBAAqB,CAChC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,EACjD,OAAO,EACP,mBAAmB,CACnB,CAAC;IACH,CAAC","file":"tokenizationFontDecorationsProvider.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 { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeightMultiplier) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeightMultiplier));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSizeMultiplier);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\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 { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeightMultiplier) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeightMultiplier));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSizeMultiplier);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\n\t}\n}\n"]}
|
|
@@ -592,6 +592,10 @@ export class ViewModel extends Disposable {
|
|
|
592
592
|
* Gives a hint that a lot of requests are about to come in for these line numbers.
|
|
593
593
|
*/
|
|
594
594
|
setViewport(startLineNumber, endLineNumber, centeredLineNumber) {
|
|
595
|
+
if (this._lines.getViewLineCount() === 0) {
|
|
596
|
+
// No visible lines to set viewport on
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
595
599
|
this._viewportStart.update(this, startLineNumber);
|
|
596
600
|
}
|
|
597
601
|
getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber) {
|