textModel.ts ×16

Frontier kind: Code frontier

unlabeled · c_4fa7a73c7c0c

99 tests · 40759 LOC · 238 files · introduces 0 tests · 98 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges98 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4967 ranges40759 lines · 238 files · Browse complete extent
All tests (intent)
99 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 98 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/textModel.ts 78 introduced LOC · 16 ranges

Open complete file

972 if (
973 initialStartLineNumber === startLineNumber
974 > && initialStartColumn === startColumn textModel.ts
975 > && initialEndLineNumber === endLineNumber
976 && initialEndColumn === endColumn
977 && range instanceof Range
1975
1976 private _deltaDecorationsImpl(ownerId: number, oldDecorationsIds: string[], newDecorations: model.IModelDeltaDecoration[], suppressEvents: boolean = false): string[] {
1977 > const versionId = this.getVersionId(); textModel.ts
1978 >
1979 > const oldDecorationsLen = oldDecorationsIds.length;
1980 > let oldDecorationIndex = 0;
1981 >
1982 > const newDecorationsLen = newDecorations.length;
1983 > let newDecorationIndex = 0;
1984 >
1985 > this._onDidChangeDecorations.beginDeferredEmit();
1986 > try {
1987 > const result = new Array<string>(newDecorationsLen);
1988 > while (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {
1989 >
1990 > let node: IntervalNode | null = null;
1991 >
1992 > if (oldDecorationIndex < oldDecorationsLen) {
1993 // (1) get ourselves an old node
1994 let decorationId: string;
2023 }
2024 }
2025 > textModel.ts
2026 > if (newDecorationIndex < newDecorationsLen) {
2027 > // (3) create a new node if necessary
2028 > if (!node) {
2029 > const internalDecorationId = (++this._lastDecorationId);
2030 > const decorationId = `${this._instanceId};${internalDecorationId}`;
2031 > node = new IntervalNode(decorationId, 0, 0);
2032 > this._decorations[decorationId] = node;
2033 > }
2034 >
2035 > // (4) initialize node
2036 > const newDecoration = newDecorations[newDecorationIndex];
2037 > const range = this._validateRangeRelaxedNoAllocations(newDecoration.range);
2038 > const options = _normalizeOptions(newDecoration.options);
2039 > const startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);
2040 > const endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);
2041 >
2042 > node.ownerId = ownerId;
2043 > node.reset(versionId, startOffset, endOffset, range);
2044 > node.setOptions(options);
2045 >
2046 > if (node.options.after) {
2047 this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.endLineNumber);
2048 }
2049 > if (node.options.before) { textModel.ts
2050 this._onDidChangeDecorations.recordLineAffectedByInjectedText(range.startLineNumber);
2051 }
2052 > if (node.options.lineHeight !== null) { textModel.ts
2053 this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(ownerId, node.id, range.startLineNumber, node.options.lineHeight);
2054 }
2055 > if (node.options.affectsFont) { textModel.ts
2056 this._onDidChangeDecorations.recordLineAffectedByFontChange(ownerId, node.id, range.startLineNumber);
2057 }
2058 > if (!suppressEvents) { textModel.ts
2059 > this._onDidChangeDecorations.checkAffectedAndFire(options);
2060 > }
2061 >
2062 > this._decorationsTree.insert(node);
2063 >
2064 > result[newDecorationIndex] = node.id;
2065 >
2066 > newDecorationIndex++;
2067 > } else {
2068 if (node) {
2069 delete this._decorations[node.id];
2070 }
2071 }
2072 > } textModel.ts
2073 >
2074 > return result;
2075 > } finally {
2076 > this._onDidChangeDecorations.endDeferredEmit();
2077 > }
2078 > }
2079
2080 //#endregion
2186 }
2187
2188 > function isNodeInjectedText(node: IntervalNode): boolean { textModel.ts
2189 > return !!node.options.after || !!node.options.before;
2190 > }
2191
2192 export interface IDecorationsTreesHost {
2306
2307 public insert(node: IntervalNode): void {
2308 > if (isNodeInjectedText(node)) { textModel.ts
2309 this._injectedTextDecorationsTree.insert(node);
2310 > } else if (isNodeInOverviewRuler(node)) { textModel.ts
2311 this._decorationsTree1.insert(node);
2312 } else {
2313 this._decorationsTree0.insert(node);
2314 }
2315 > } textModel.ts
2316
2317 public delete(node: IntervalNode): void {
2486
2487 public static createDynamic(options: model.IModelDecorationOptions): ModelDecorationOptions {
2488 > return new ModelDecorationOptions(options); textModel.ts
2489 > }
2490 readonly description: string;
2491 readonly blockClassName: string | null;
2576 ];
2577
2578 > function _normalizeOptions(options: model.IModelDecorationOptions): ModelDecorationOptions { textModel.ts
2579 > if (options instanceof ModelDecorationOptions) {
2580 return options;
2581 }
2582 > return ModelDecorationOptions.createDynamic(options); textModel.ts
2583 > }
2584
2585
2655
2656 public checkAffectedAndFire(options: ModelDecorationOptions): void {
2657 > this._affectsMinimap ||= !!options.minimap?.position; textModel.ts
2658 > this._affectsOverviewRuler ||= !!options.overviewRuler?.color;
2659 > this._affectsGlyphMargin ||= !!options.glyphMarginClassName;
2660 > this._affectsLineNumber ||= !!options.lineNumberClassName;
2661 > this.tryFire();
2662 > }
2663
2664 public fire(): void {
src/vs/editor/common/model/intervalTree.ts 20 introduced LOC · 2 ranges

Open complete file

196
197 public reset(versionId: number, start: number, end: number, range: Range): void {
198 > this.start = start; intervalTree.ts
199 > this.end = end;
200 > this.maxEnd = end;
201 > this.cachedVersionId = versionId;
202 > this.cachedAbsoluteStart = start;
203 > this.cachedAbsoluteEnd = end;
204 > this.range = range;
205 > }
206
207 public setOptions(options: ModelDecorationOptions) {
208 > this.options = options; intervalTree.ts
209 > const className = this.options.className;
210 > setNodeIsForValidation(this, (
211 > className === ClassName.EditorErrorDecoration
212 > || className === ClassName.EditorWarningDecoration
213 > || className === ClassName.EditorInfoDecoration
214 > ));
215 > setNodeIsInGlyphMargin(this, this.options.glyphMarginClassName !== null);
216 > _setNodeStickiness(this, <number>this.options.stickiness);
217 > setCollapseOnReplaceEdit(this, this.options.collapseOnReplaceEdit);
218 > setNodeAffectsFont(this, this.options.affectsFont ?? false);
219 > }
220
221 public setCachedOffsets(absoluteStart: number, absoluteEnd: number, cachedVersionId: number): void {