rangeMapping.ts ×5

Frontier kind: Code frontier

unlabeled · c_ca1b2339d720

61 tests · 6480 LOC · 40 files · introduces 0 tests · 28 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges28 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1072 ranges6480 lines · 40 files · Browse complete extent
All tests (intent)
61 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: 28 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/diff/rangeMapping.ts 26 introduced LOC · 5 ranges

Open complete file

360
361 export function getLineRangeMapping(rangeMapping: RangeMapping, originalLines: AbstractText, modifiedLines: AbstractText): DetailedLineRangeMapping {
362 > let lineStartDelta = 0; rangeMapping.ts
363 > let lineEndDelta = 0;
364 >
365 > // rangeMapping describes the edit that replaces `rangeMapping.originalRange` with `newText := getText(modifiedLines, rangeMapping.modifiedRange)`.
366 >
367 > // original: ]xxx \n <- this line is not modified
368 > // modified: ]xx \n
369 > if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1
370 && rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber
371 > && rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) { rangeMapping.ts
372 // We can only do this if the range is not empty yet
373 lineEndDelta = -1;
374 }
376 > // original: xxx[ \n <- this line is not modified
377 > // modified: xxx[ \n
378 > if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines.getLineLength(rangeMapping.modifiedRange.startLineNumber)
379 && rangeMapping.originalRange.startColumn - 1 >= originalLines.getLineLength(rangeMapping.originalRange.startLineNumber)
380 && rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta
381 > && rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) { rangeMapping.ts
382 // We can only do this if the range is not empty yet
383 lineStartDelta = 1;
384 }
386 > const originalLineRange = new LineRange(
387 > rangeMapping.originalRange.startLineNumber + lineStartDelta,
388 > rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta
389 > );
390 > const modifiedLineRange = new LineRange(
391 > rangeMapping.modifiedRange.startLineNumber + lineStartDelta,
392 > rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta
393 > );
394 >
395 > return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]);
396 > }
397
398 export function lineRangeMappingFromChange(change: IChange): LineRangeMapping {
src/vs/editor/common/core/text/abstractText.ts 2 introduced LOC · 1 range

Open complete file

90
91 override getLineLength(lineNumber: number): number {
92 > return this._getLineContent(lineNumber).length; abstractText.ts
93 > }
94
95 get length(): TextLength {