computeMovedLines.ts ×6

Frontier kind: Code frontier

unlabeled · c_bf2a98e87a9a

6 tests · 9583 LOC · 52 files · introduces 0 tests · 30 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges30 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1740 ranges9583 lines · 52 files · Browse complete extent
All tests (intent)
6 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: 30 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts 28 introduced LOC · 6 ranges

Open complete file

206 let extendToTop: number;
207 for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) {
208 > const origLine = move.original.startLineNumber - extendToTop - 1; computeMovedLines.ts
209 > const modLine = move.modified.startLineNumber - extendToTop - 1;
210 > if (origLine > originalLines.length || modLine > modifiedLines.length) {
211 break;
212 }
213 > if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) { computeMovedLines.ts
214 break;
215 }
216 > if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout)) { computeMovedLines.ts
217 > break;
218 > }
219 > }
220
221 if (extendToTop > 0) {
258 if (line1.trim() === line2.trim()) { return true; }
259 if (line1.length > 300 && line2.length > 300) { return false; }
261 > const myersDiffingAlgorithm = new MyersDiffAlgorithm();
262 > const result = myersDiffingAlgorithm.compute(
263 > new LinesSliceCharSequence([line1], new Range(1, 1, 1, line1.length), false),
264 > new LinesSliceCharSequence([line2], new Range(1, 1, 1, line2.length), false),
265 > timeout
266 > );
267 > let commonNonSpaceCharCount = 0;
268 > const inverted = SequenceDiff.invert(result.diffs, line1.length);
269 > for (const seq of inverted) {
270 > seq.seq1Range.forEach(idx => {
271 if (!isSpace(line1.charCodeAt(idx))) {
272 commonNonSpaceCharCount++;
273 }
275 > }
276 >
277 > function countNonWsChars(str: string): number {
278 > let count = 0;
279 > for (let i = 0; i < line1.length; i++) {
280 if (!isSpace(str.charCodeAt(i))) {
281 count++;
282 }
283 }
284 > return count; computeMovedLines.ts
285 > }
286 >
287 const longerLineLength = countNonWsChars(line1.length > line2.length ? line1 : line2);
288 const r = commonNonSpaceCharCount / longerLineLength > 0.6 && longerLineLength > 10;
src/vs/editor/common/core/ranges/offsetRange.ts 2 introduced LOC · 2 ranges

Open complete file

202
203 public forEach(f: (offset: number) => void): void {
204 > for (let i = this.start; i < this.endExclusive; i++) { offsetRange.ts
205 f(i);
206 }
207 > } offsetRange.ts
208
209 /**