pieceTreeBase.ts ×8

Frontier kind: Joint frontier

unlabeled · c_6584f78c4b40

1 test · 39959 LOC · 238 files · introduces 1 test · 58 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges58 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
4810 ranges39959 lines · 238 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

1 file ranked by introduced lines: 58 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.ts 58 introduced LOC · 8 ranges

Open complete file

701
702 if (searcher._wordSeparators) {
703 > searchText = buffer.buffer.substring(start, end); pieceTreeBase.ts
704 > offsetInBuffer = (offset: number) => offset + start;
705 > searcher.reset(0);
706 } else {
707 searchText = buffer.buffer;
756 return result;
757 }
759 > let startLineNumber = searchRange.startLineNumber;
760 >
761 > let currentNode = startPosition.node;
762 > while (currentNode !== endPosition.node) {
763 > const lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);
764 >
765 > if (lineBreakCnt >= 1) {
766 > // last line break position
767 > const lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;
768 > const startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);
769 > const nextLineStartOffset = lineStarts[start.line + lineBreakCnt];
770 > const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
771 > resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);
772 >
773 > if (resultLen >= limitResultCount) {
774 return result;
775 }
777 > startLineNumber += lineBreakCnt;
778 > }
779 >
780 > const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
781 > // search for the remaining content
782 > if (startLineNumber === searchRange.endLineNumber) {
783 const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);
784 resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
785 return result;
786 }
788 > resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn), startLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
789 >
790 > if (resultLen >= limitResultCount) {
791 return result;
792 }
794 > startLineNumber++;
795 > startPosition = this.nodeAt2(startLineNumber, 1);
796 > currentNode = startPosition.node;
797 > start = this.positionInBuffer(startPosition.node, startPosition.remainder);
798 > }
799 >
800 > if (startLineNumber === searchRange.endLineNumber) {
801 > const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
802 > const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);
803 > resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
804 > return result;
805 > }
806
807 const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
811
812 private _findMatchesInLine(searchData: SearchData, searcher: Searcher, text: string, lineNumber: number, deltaOffset: number, resultLen: number, result: FindMatch[], captureMatches: boolean, limitResultCount: number): number {
813 > const wordSeparators = searchData.wordSeparators; pieceTreeBase.ts
814 > if (!captureMatches && searchData.simpleSearch) {
815 const searchString = searchData.simpleSearch;
816 const searchStringLen = searchString.length;
828 return resultLen;
829 }
831 > let m: RegExpExecArray | null;
832 > // Reset regex to search from the beginning
833 > searcher.reset(0);
834 > do {
835 > m = searcher.next(text);
836 > if (m) {
837 > result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);
838 > if (resultLen >= limitResultCount) {
839 return resultLen;
840 }
842 > } while (m);
843 > return resultLen;
844 > }
845
846 // #endregion