src/vs/editor/common/diff/linesDiffComputer.ts

59 LOC · 57 covered · 2 uncovered · 6 ranges · 394 concepts · 3 introducers · 182 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- legacyLinesDiffComputer.ts ×28
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { DetailedLineRangeMapping, LineRangeMapping } from './rangeMapping.js';
7 >
8 > export interface ILinesDiffComputer {
9 > computeDiff(originalLines: string[], modifiedLines: string[], options: ILinesDiffComputerOptions): LinesDiff;
10 > }
11 >
12 > export interface ILinesDiffComputerOptions {
13 > readonly ignoreTrimWhitespace: boolean;
14 > readonly maxComputationTimeMs: number;
15 > readonly computeMoves: boolean;
16 > readonly extendToSubwords?: boolean;
17 > }
18 >
19 > export class LinesDiff {
20 > constructor(
21 > readonly changes: readonly DetailedLineRangeMapping[], linesDiffComputer.ts ×1
22 >
23 > /**
24 > * Sorted by original line ranges.
25 > * The original line ranges and the modified line ranges must be disjoint (but can be touching).
26 > */
27 > readonly moves: readonly MovedText[],
28 >
29 > /**
30 > * Indicates if the time out was reached.
31 > * In that case, the diffs might be an approximation and the user should be asked to rerun the diff with more time.
32 > */
33 > readonly hitTimeout: boolean,
34 > ) {
35 > }
37 >
38 > export class MovedText {
39 > public readonly lineRangeMapping: LineRangeMapping;
40 >
41 > /**
42 > * The diff from the original text to the moved text.
43 > * Must be contained in the original/modified line range.
44 > * Can be empty if the text didn't change (only moved).
45 > */
46 > public readonly changes: readonly DetailedLineRangeMapping[];
47 >
48 > constructor(
49 > lineRangeMapping: LineRangeMapping, defaultLinesDiffComputer.ts ×1
50 > changes: readonly DetailedLineRangeMapping[],
51 > ) {
52 > this.lineRangeMapping = lineRangeMapping;
53 > this.changes = changes;
54 > }
56 > public flip(): MovedText {
57 return new MovedText(this.lineRangeMapping.flip(), this.changes.map(c => c.flip()));
58 }