textEdit.ts ×8

Frontier kind: Code frontier

unlabeled · c_bbda7c2f8ae8

176 tests · 6019 LOC · 34 files · introduces 0 tests · 19 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges19 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
987 ranges6019 lines · 34 files · Browse complete extent
All tests (intent)
176 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: 19 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/core/edits/textEdit.ts 16 introduced LOC · 8 ranges

Open complete file

49 */
50 normalize(): TextEdit {
51 > const replacements: TextReplacement[] = []; textEdit.ts
52 > for (const r of this.replacements) {
53 if (replacements.length > 0 && replacements[replacements.length - 1].range.getEndPosition().equals(r.range.getStartPosition())) {
54 const last = replacements[replacements.length - 1];
58 }
59 }
60 > return new TextEdit(replacements); textEdit.ts
61 > }
62
63 mapPosition(position: Position): Position | Range {
129
130 apply(text: AbstractText): string {
131 > let result = ''; textEdit.ts
132 > let lastEditEnd = new Position(1, 1);
133 > for (const replacement of this.replacements) {
134 const editRange = replacement.range;
135 const editStart = editRange.getStartPosition();
143 lastEditEnd = editEnd;
144 }
145 > const r = rangeFromPositions(lastEditEnd, text.endPositionExclusive); textEdit.ts
146 > if (!r.isEmpty()) {
147 result += text.getValueOfRange(r);
148 }
149 > return result; textEdit.ts
150 > }
151
152 applyToString(str: string): string {
775 }
776
777 > function rangeFromPositions(start: Position, end: Position): Range { textEdit.ts
778 > if (start.lineNumber === end.lineNumber && start.column === Number.MAX_SAFE_INTEGER) {
779 return Range.fromPositions(end, end);
780 > } else if (!start.isBeforeOrEqual(end)) { textEdit.ts
781 throw new BugIndicatingError('start must be before end');
782 }
783 > return new Range(start.lineNumber, start.column, end.lineNumber, end.column); textEdit.ts
784 > }
src/vs/editor/common/core/text/textLength.ts 3 introduced LOC · 3 ranges

Open complete file

129
130 public addToPosition(position: Position): Position {
131 > if (this.lineCount === 0) { textLength.ts
132 return new Position(position.lineNumber, position.column + this.columnCount);
133 > } else { textLength.ts
134 return new Position(position.lineNumber + this.lineCount, this.columnCount + 1);
135 }
136 > } textLength.ts
137
138 public addToRange(range: Range): Range {