linesSliceCharSequence.ts ×7

Frontier kind: Code frontier

unlabeled · c_bf00c0b9499a

54 tests · 8724 LOC · 52 files · introduces 0 tests · 31 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges31 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1461 ranges8724 lines · 52 files · Browse complete extent
All tests (intent)
54 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.

3 files ranked by introduced lines: 31 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.ts 15 introduced LOC · 7 ranges

Open complete file

122 */
123 public findWordContaining(offset: number): OffsetRange | undefined {
124 > if (offset < 0 || offset >= this.elements.length) { linesSliceCharSequence.ts
125 return undefined;
126 }
128 > if (!isWordChar(this.elements[offset])) {
129 > return undefined;
130 > }
131
132 // find start
133 let start = offset;
134 > while (start > 0 && isWordChar(this.elements[start - 1])) { linesSliceCharSequence.ts
135 start--;
136 }
138 // find end
139 let end = offset;
140 > while (end < this.elements.length && isWordChar(this.elements[end])) { linesSliceCharSequence.ts
141 end++;
142 }
143
144 return new OffsetRange(start, end);
146
147 /** fooBar has the two sub-words foo and bar */
175
176 public isStronglyEqual(offset1: number, offset2: number): boolean {
177 > return this.elements[offset1] === this.elements[offset2]; linesSliceCharSequence.ts
178 > }
179
180 public extendToFullLines(range: OffsetRange): OffsetRange {
185 }
186
187 > function isWordChar(charCode: number): boolean { linesSliceCharSequence.ts
188 > return charCode >= CharCode.a && charCode <= CharCode.z
189 > || charCode >= CharCode.A && charCode <= CharCode.Z
190 > || charCode >= CharCode.Digit0 && charCode <= CharCode.Digit9;
191 > }
192
193 function isUpperCase(charCode: number): boolean {
src/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.ts 13 introduced LOC · 5 ranges

Open complete file

234
235 function scanWord(pair: OffsetPair, equalMapping: SequenceDiff) {
236 > if (pair.offset1 < lastPoint.offset1 || pair.offset2 < lastPoint.offset2) { heuristicSequenceOptimizations.ts
237 return;
238 }
240 > const w1 = findParent(sequence1, pair.offset1);
241 > const w2 = findParent(sequence2, pair.offset2);
242 > if (!w1 || !w2) {
243 > return;
244 > }
245 let w = new SequenceDiff(w1, w2);
246 const equalPart = w.intersect(equalMapping)!;
278 }
279
280 > if ((force && equalChars1 + equalChars2 < w.seq1Range.length + w.seq2Range.length) || equalChars1 + equalChars2 < (w.seq1Range.length + w.seq2Range.length) * 2 / 3) { heuristicSequenceOptimizations.ts
281 additional.push(w);
282 }
283
284 lastPoint = w.getEndExclusives();
286
287 while (equalMappings.length > 0) {
290 continue;
291 }
292 > scanWord(next.getStarts(), next); heuristicSequenceOptimizations.ts
293 > // The equal parts are not empty, so -1 gives us a character that is equal in both parts.
294 > scanWord(next.getEndExclusives().delta(-1), next);
295 > }
296
297 const merged = mergeSequenceDiffs(sequenceDiffs, additional);
src/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.ts 3 introduced LOC · 2 ranges

Open complete file

140
141 public delta(offset: number): OffsetPair {
142 > if (offset === 0) { diffAlgorithm.ts
143 return this;
144 }
145 > return new OffsetPair(this.offset1 + offset, this.offset2 + offset); diffAlgorithm.ts
146 > }
147
148 public equals(other: OffsetPair): boolean {