Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/util/vs/base/common/diff/diffChange.ts
13406 views
1
//!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
2
3
/*---------------------------------------------------------------------------------------------
4
* Copyright (c) Microsoft Corporation. All rights reserved.
5
* Licensed under the MIT License. See License.txt in the project root for license information.
6
*--------------------------------------------------------------------------------------------*/
7
8
/**
9
* Represents information about a specific difference between two sequences.
10
*/
11
export class DiffChange {
12
13
/**
14
* The position of the first element in the original sequence which
15
* this change affects.
16
*/
17
public originalStart: number;
18
19
/**
20
* The number of elements from the original sequence which were
21
* affected.
22
*/
23
public originalLength: number;
24
25
/**
26
* The position of the first element in the modified sequence which
27
* this change affects.
28
*/
29
public modifiedStart: number;
30
31
/**
32
* The number of elements from the modified sequence which were
33
* affected (added).
34
*/
35
public modifiedLength: number;
36
37
/**
38
* Constructs a new DiffChange with the given sequence information
39
* and content.
40
*/
41
constructor(originalStart: number, originalLength: number, modifiedStart: number, modifiedLength: number) {
42
//Debug.Assert(originalLength > 0 || modifiedLength > 0, "originalLength and modifiedLength cannot both be <= 0");
43
this.originalStart = originalStart;
44
this.originalLength = originalLength;
45
this.modifiedStart = modifiedStart;
46
this.modifiedLength = modifiedLength;
47
}
48
49
/**
50
* The end point (exclusive) of the change in the original sequence.
51
*/
52
public getOriginalEnd() {
53
return this.originalStart + this.originalLength;
54
}
55
56
/**
57
* The end point (exclusive) of the change in the modified sequence.
58
*/
59
public getModifiedEnd() {
60
return this.modifiedStart + this.modifiedLength;
61
}
62
}
63
64