intervalTree.ts ×13

Frontier kind: Code frontier

unlabeled · c_96bbff3d9c4a

60 tests · 5351 LOC · 21 files · introduces 0 tests · 44 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges44 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
570 ranges5351 lines · 21 files · Browse complete extent
All tests (intent)
60 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: 44 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/intervalTree.ts 44 introduced LOC · 13 ranges

Open complete file

119 );
120 }
121 > function getNodeStickiness(node: IntervalNode): TrackedRangeStickiness { intervalTree.ts
122 > return ((node.metadata & Constants.StickinessMask) >>> Constants.StickinessOffset);
123 > }
124 function _setNodeStickiness(node: IntervalNode, stickiness: TrackedRangeStickiness): void {
125 node.metadata = (
415 */
416 export function nodeAcceptEdit(node: IntervalNode, start: number, end: number, textLength: number, forceMoveMarkers: boolean): void {
417 > const nodeStickiness = getNodeStickiness(node); intervalTree.ts
418 > const startStickToPreviousCharacter = (
419 > nodeStickiness === TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
420 || nodeStickiness === TrackedRangeStickiness.GrowsOnlyWhenTypingBefore
421 > ); intervalTree.ts
422 > const endStickToPreviousCharacter = (
423 > nodeStickiness === TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
424 || nodeStickiness === TrackedRangeStickiness.GrowsOnlyWhenTypingBefore
425 > ); intervalTree.ts
426 >
427 > const deletingCnt = (end - start);
428 > const insertingCnt = textLength;
429 > const commonLength = Math.min(deletingCnt, insertingCnt);
430 >
431 > const nodeStart = node.start;
432 > let startDone = false;
433 >
434 > const nodeEnd = node.end;
435 > let endDone = false;
436 >
437 > if (start <= nodeStart && nodeEnd <= end && getCollapseOnReplaceEdit(node)) {
438 // This edit encompasses the entire decoration range
439 // and the decoration has asked to become collapsed
443 endDone = true;
444 }
446 > {
447 > const moveSemantics = forceMoveMarkers ? MarkerMoveSemantics.ForceMove : (deletingCnt > 0 ? MarkerMoveSemantics.ForceStay : MarkerMoveSemantics.MarkerDefined);
448 > if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start, moveSemantics)) {
449 startDone = true;
450 }
451 > if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start, moveSemantics)) { intervalTree.ts
452 endDone = true;
453 }
454 > } intervalTree.ts
455 >
456 > if (commonLength > 0 && !forceMoveMarkers) {
457 const moveSemantics = (deletingCnt > insertingCnt ? MarkerMoveSemantics.ForceStay : MarkerMoveSemantics.MarkerDefined);
458 if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start + commonLength, moveSemantics)) {
463 }
464 }
466 > {
467 > const moveSemantics = forceMoveMarkers ? MarkerMoveSemantics.ForceMove : MarkerMoveSemantics.MarkerDefined;
468 > if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, end, moveSemantics)) {
469 node.start = start + insertingCnt;
470 startDone = true;
471 }
472 > if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, end, moveSemantics)) { intervalTree.ts
473 node.end = start + insertingCnt;
474 endDone = true;
475 }
476 > } intervalTree.ts
477 >
478 > // Finish
479 > const deltaColumn = (insertingCnt - deletingCnt);
480 > if (!startDone) {
481 node.start = Math.max(0, nodeStart + deltaColumn);
482 }
483 > if (!endDone) { intervalTree.ts
484 node.end = Math.max(0, nodeEnd + deltaColumn);
485 }
487 > if (node.start > node.end) {
488 node.end = node.start;
489 }
490 > } intervalTree.ts
491
492 function searchForEditing(T: IntervalTree, start: number, end: number): IntervalNode[] {