Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/diff/common/diffService.ts
13400 views
1
/*---------------------------------------------------------------------------------------------
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 { createServiceIdentifier } from '../../../util/common/services';
7
import { ILinesDiffComputerOptions, MovedText } from '../../../util/vs/editor/common/diff/linesDiffComputer';
8
import { DetailedLineRangeMapping } from '../../../util/vs/editor/common/diff/rangeMapping';
9
10
11
export const IDiffService = createServiceIdentifier<IDiffService>('IDiffService');
12
13
export interface IDiffService {
14
15
readonly _serviceBrand: undefined;
16
17
computeDiff(original: string, modified: string, options: ILinesDiffComputerOptions): Promise<IDocumentDiff>;
18
}
19
20
export interface IDocumentDiff {
21
/**
22
* If true, both text models are identical (byte-wise).
23
*/
24
readonly identical: boolean;
25
26
/**
27
* If true, the diff computation timed out and the diff might not be accurate.
28
*/
29
readonly quitEarly: boolean;
30
31
/**
32
* Maps all modified line ranges in the original to the corresponding line ranges in the modified text model.
33
*/
34
readonly changes: readonly DetailedLineRangeMapping[];
35
36
/**
37
* Sorted by original line ranges.
38
* The original line ranges and the modified line ranges must be disjoint (but can be touching).
39
*/
40
readonly moves: readonly MovedText[];
41
}
42
43