textModel.ts ×6

Frontier kind: Code frontier

unlabeled · c_a3c945b06fe8

26 tests · 40977 LOC · 238 files · introduces 0 tests · 81 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges81 lines · 5 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5061 ranges40977 lines · 238 files · Browse complete extent
All tests (intent)
26 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.

5 files ranked by introduced lines: 81 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/textModel.ts 37 introduced LOC · 6 ranges

Open complete file

552 return;
553 }
554 > textModel.ts
555 > const oldFullModelRange = this.getFullModelRange();
556 > const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);
557 > const endLineNumber = this.getLineCount();
558 > const endColumn = this.getLineMaxColumn(endLineNumber);
559 >
560 > this._onBeforeEOLChange();
561 > this._buffer.setEOL(newEOL);
562 > this._increaseVersionId();
563 > this._onAfterEOLChange();
564 >
565 > this._emitContentChangedEvent(
566 > new ModelRawContentChangedEvent(
567 > [
568 > new ModelRawEOLChanged()
569 > ],
570 > this._versionId,
571 > false,
572 > false
573 > ),
574 > this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, new Position(endLineNumber, endColumn), this.getValue(), false, false, false, true, EditSources.eolChange())
575 > );
576 }
577
578 private _onBeforeEOLChange(): void {
579 > // Ensure all decorations get their `range` set. textModel.ts
580 > this._decorationsTree.ensureAllNodesHaveRanges(this);
581 > }
582
583 private _onAfterEOLChange(): void {
584 > // Transform back `range` to offsets textModel.ts
585 > const versionId = this.getVersionId();
586 > const allDecorations = this._decorationsTree.collectNodesPostOrder();
587 > for (let i = 0, len = allDecorations.length; i < len; i++) {
588 const node = allDecorations[i];
589 const range = node.range!; // the range is defined due to `_onBeforeEOLChange`
603 recomputeMaxEnd(node);
604 }
605 > } textModel.ts
606
607 public onBeforeAttached(): model.IAttachedView {
2219
2220 public ensureAllNodesHaveRanges(host: IDecorationsTreesHost): void {
2221 > this.getAll(host, 0, false, false, false, false); textModel.ts
2222 > }
2223
2224 private _ensureNodesHaveRanges(host: IDecorationsTreesHost, nodes: IntervalNode[]): model.IModelDecoration[] {
2299
2300 public collectNodesPostOrder(): IntervalNode[] {
2301 > const r0 = this._decorationsTree0.collectNodesPostOrder(); textModel.ts
2302 > const r1 = this._decorationsTree1.collectNodesPostOrder();
2303 > const r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();
2304 > return r0.concat(r1).concat(r2);
2305 > }
2306
2307 public insert(node: IntervalNode): void {
src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts 29 introduced LOC · 3 ranges

Open complete file

319
320 normalizeEOL(eol: '\r\n' | '\n') {
321 > const averageBufferSize = AverageBufferSize; pieceTreeBase.ts
322 > const min = averageBufferSize - Math.floor(averageBufferSize / 3);
323 > const max = min * 2;
324 >
325 > let tempChunk = '';
326 > let tempChunkLen = 0;
327 > const chunks: StringBuffer[] = [];
328 >
329 > this.iterate(this.root, node => {
330 > const str = this.getNodeContent(node);
331 > const len = str.length;
332 > if (tempChunkLen <= min || tempChunkLen + len < max) {
333 > tempChunk += str;
334 > tempChunkLen += len;
335 > return true;
336 > }
337
338 // flush anyways
342 tempChunkLen = len;
343 return true;
344 > }); pieceTreeBase.ts
345 >
346 > if (tempChunkLen > 0) {
347 > const text = tempChunk.replace(/\r\n|\r|\n/g, eol);
348 > chunks.push(new StringBuffer(text, createLineStartsFast(text)));
349 > }
350 >
351 > this.create(chunks, eol, true);
352 > }
353
354 // #region Buffer API
358
359 public setEOL(newEOL: '\r\n' | '\n'): void {
360 > this._EOL = newEOL; pieceTreeBase.ts
361 > this._EOLLength = this._EOL.length;
362 > this.normalizeEOL(newEOL);
363 > }
364
365 public createSnapshot(BOM: string): ITextSnapshot {
src/vs/editor/common/model/intervalTree.ts 12 introduced LOC · 3 ranges

Open complete file

276 */
277 public collectNodesPostOrder(): IntervalNode[] {
278 > return collectNodesPostOrder(this); intervalTree.ts
279 > }
280
281 public insert(node: IntervalNode): void {
674 }
675
676 > function collectNodesPostOrder(T: IntervalTree): IntervalNode[] { intervalTree.ts
677 > let node = T.root;
678 > const result: IntervalNode[] = [];
679 > let resultLen = 0;
680 > while (node !== SENTINEL) {
681 if (getNodeIsVisited(node)) {
682 // going up from this node
703 setNodeIsVisited(node, true);
704 }
706 > setNodeIsVisited(T.root, false);
707 >
708 > return result;
709 > }
710
711 function search(T: IntervalTree, filterOwnerId: number, filterOutValidation: boolean, filterFontDecorations: boolean, cachedVersionId: number, onlyMarginDecorations: boolean): IntervalNode[] {
src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts 2 introduced LOC · 1 range

Open complete file

238
239 public setEOL(newEOL: '\r\n' | '\n'): void {
240 > this._pieceTree.setEOL(newEOL); pieceTreeTextBuffer.ts
241 > }
242
243 public applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean, computeUndoEdits: boolean): ApplyEditsResult {
src/vs/editor/common/textModelEvents.ts 1 introduced LOC · 1 range

Open complete file

443 */
444 export class ModelRawEOLChanged {
445 > public readonly changeType = RawContentChangedType.EOLChanged; textModelEvents.ts
446 }
447