forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentDiffProvider.ts
More file actions
59 lines (51 loc) · 1.83 KB
/
documentDiffProvider.ts
File metadata and controls
59 lines (51 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from 'vs/base/common/event';
import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer';
import { ITextModel } from 'vs/editor/common/model';
/**
* A document diff provider computes the diff between two text models.
*/
export interface IDocumentDiffProvider {
/**
* Computes the diff between the text models `original` and `modified`.
*/
computeDiff(original: ITextModel, modified: ITextModel, options: IDocumentDiffProviderOptions): Promise<IDocumentDiff>;
/**
* Is fired when settings of the diff algorithm change that could alter the result of the diffing computation.
* Any user of this provider should recompute the diff when this event is fired.
*/
onDidChange: Event<void>;
}
/**
* Options for the diff computation.
*/
export interface IDocumentDiffProviderOptions {
/**
* When set to true, the diff should ignore whitespace changes.i
*/
ignoreTrimWhitespace: boolean;
/**
* A diff computation should throw if it takes longer than this value.
*/
maxComputationTimeMs: number;
}
/**
* Represents a diff between two text models.
*/
export interface IDocumentDiff {
/**
* If true, both text models are identical (byte-wise).
*/
readonly identical: boolean;
/**
* If true, the diff computation timed out and the diff might not be accurate.
*/
readonly quitEarly: boolean;
/**
* Maps all modified line ranges in the original to the corresponding line ranges in the modified text model.
*/
readonly changes: LineRangeMapping[];
}