diff.ts ×10

Frontier kind: Code frontier

unlabeled · c_acd44dd316ee

79 tests · 6212 LOC · 31 files · introduces 0 tests · 67 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges67 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
907 ranges6212 lines · 31 files · Browse complete extent
All tests (intent)
79 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.

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

src/vs/base/common/diff/diff.ts 67 introduced LOC · 10 ranges

Open complete file

143 */
144 constructor() {
145 > this.m_changes = []; diff.ts
146 > this.m_originalStart = Constants.MAX_SAFE_SMALL_INTEGER;
147 > this.m_modifiedStart = Constants.MAX_SAFE_SMALL_INTEGER;
148 > this.m_originalCount = 0;
149 > this.m_modifiedCount = 0;
150 > }
151
152 /**
154 */
155 public MarkNextChange(): void {
156 > // Only add to the list if there is something to add diff.ts
157 > if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
158 > // Add the new change to our list
159 > this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount,
160 > this.m_modifiedStart, this.m_modifiedCount));
161 > }
162 >
163 > // Reset for the next change
164 > this.m_originalCount = 0;
165 > this.m_modifiedCount = 0;
166 > this.m_originalStart = Constants.MAX_SAFE_SMALL_INTEGER;
167 > this.m_modifiedStart = Constants.MAX_SAFE_SMALL_INTEGER;
168 > }
169
170 /**
214 */
215 public getReverseChanges(): DiffChange[] {
216 > if (this.m_originalCount > 0 || this.m_modifiedCount > 0) { diff.ts
217 > // Finish up on whatever is left
218 > this.MarkNextChange();
219 > }
220 >
221 > this.m_changes.reverse();
222 > return this.m_changes;
223 > }
224
225 }
409
410 if (result !== null) {
411 > // Result is not-null when there was enough memory to compute the changes while diff.ts
412 > // searching for the recursion point
413 > return result;
414 } else if (!quitEarlyArr[0]) {
415 // We can break the problem down recursively by finding the changes in the
441
442 private WALKTRACE(diagonalForwardBase: number, diagonalForwardStart: number, diagonalForwardEnd: number, diagonalForwardOffset: number,
443 > diagonalReverseBase: number, diagonalReverseStart: number, diagonalReverseEnd: number, diagonalReverseOffset: number, diff.ts
444 > forwardPoints: Int32Array, reversePoints: Int32Array,
445 > originalIndex: number, originalEnd: number, midOriginalArr: number[],
446 > modifiedIndex: number, modifiedEnd: number, midModifiedArr: number[],
447 > deltaIsEven: boolean, quitEarlyArr: boolean[]
448 > ): DiffChange[] {
449 > let forwardChanges: DiffChange[] | null = null;
450 > let reverseChanges: DiffChange[] | null = null;
451 >
452 > // First, walk backward through the forward diagonals history
453 > let changeHelper = new DiffChangeHelper();
454 > let diagonalMin = diagonalForwardStart;
455 > let diagonalMax = diagonalForwardEnd;
456 > let diagonalRelative = (midOriginalArr[0] - midModifiedArr[0]) - diagonalForwardOffset;
457 > let lastOriginalIndex = Constants.MIN_SAFE_SMALL_INTEGER;
458 > let historyIndex = this.m_forwardHistory.length - 1;
459 >
460 > do {
461 > // Get the diagonal index from the relative diagonal number
462 > const diagonal = diagonalRelative + diagonalForwardBase;
463 >
464 > // Figure out where we came from
465 > if (diagonal === diagonalMin || (diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1])) {
466 // Vertical line (the element is an insert)
467 originalIndex = forwardPoints[diagonal + 1];
473 changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);
474 diagonalRelative = (diagonal + 1) - diagonalForwardBase; //Setup for the next iteration
475 > } else { diff.ts
476 // Horizontal line (the element is a deletion)
477 originalIndex = forwardPoints[diagonal - 1] + 1;
484 diagonalRelative = (diagonal - 1) - diagonalForwardBase; //Setup for the next iteration
485 }
486 > diff.ts
487 > if (historyIndex >= 0) {
488 forwardPoints = this.m_forwardHistory[historyIndex];
489 diagonalForwardBase = forwardPoints[0]; //We stored this in the first spot
491 diagonalMax = forwardPoints.length - 1;
492 }
493 > } while (--historyIndex >= -1); diff.ts
494 >
495 > // Ironically, we get the forward changes as the reverse of the
496 > // order we added them since we technically added them backwards
497 > forwardChanges = changeHelper.getReverseChanges();
498 >
499 > if (quitEarlyArr[0]) {
500 // TODO: Calculate a partial from the reverse diagonals.
501 // For now, just assume everything after the midOriginal/midModified point is a diff
514 modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)
515 ];
516 > } else { diff.ts
517 // Now walk backward through the reverse diagonals history
518 changeHelper = new DiffChangeHelper();
562 reverseChanges = changeHelper.getChanges();
563 }
564 > diff.ts
565 > return this.ConcatenateChanges(forwardChanges, reverseChanges);
566 > }
567
568 /**