pieceTreeBase.ts ×7

Frontier kind: Code frontier

unlabeled · c_1dce039576c3

55 tests · 39258 LOC · 238 files · introduces 0 tests · 38 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges38 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4582 ranges39258 lines · 238 files · Browse complete extent
All tests (intent)
55 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: 38 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts 36 introduced LOC · 7 ranges

Open complete file

514
515 public getLinesContent(): string[] {
516 > const lines: string[] = []; pieceTreeBase.ts
517 > let linesLength = 0;
518 > let currentLine = '';
519 > let danglingCR = false;
520 >
521 > this.iterate(this.root, node => {
522 > if (node === SENTINEL) {
523 > return true;
524 > }
525 >
526 > const piece = node.piece;
527 > let pieceLength = piece.length;
528 > if (pieceLength === 0) {
529 return true;
530 }
532 > const buffer = this._buffers[piece.bufferIndex].buffer;
533 > const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
534 >
535 > const pieceStartLine = piece.start.line;
536 > const pieceEndLine = piece.end.line;
537 > let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;
538 >
539 > if (danglingCR) {
540 if (buffer.charCodeAt(pieceStartOffset) === CharCode.LineFeed) {
541 // pretend the \n was in the previous piece..
550 }
551 }
553 > if (pieceStartLine === pieceEndLine) {
554 // this piece has no new lines
555 if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === CharCode.CarriageReturn) {
567 ? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength))
568 : buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\r\n|\r|\n)$/, '')
569 > ); pieceTreeBase.ts
570 > lines[linesLength++] = currentLine;
571 >
572 > for (let line = pieceStartLine + 1; line < pieceEndLine; line++) {
573 currentLine = (
574 this._EOLNormalized
579 }
580
581 > if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === CharCode.CarriageReturn) { pieceTreeBase.ts
582 danglingCR = true;
583 if (piece.end.column === 0) {
592
593 return true;
594 > }); pieceTreeBase.ts
595 >
596 > if (danglingCR) {
597 lines[linesLength++] = currentLine;
598 currentLine = '';
599 }
601 > lines[linesLength++] = currentLine;
602 > return lines;
603 > }
604
605 public getLength(): number {
src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts 2 introduced LOC · 1 range

Open complete file

181
182 public getLinesContent(): string[] {
183 > return this._pieceTree.getLinesContent(); pieceTreeTextBuffer.ts
184 > }
185
186 public getLineContent(lineNumber: number): string {