Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/inlineEdits/node/nextEditResult.ts
13399 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 type { Command } from 'vscode';
7
import { DocumentId } from '../../../platform/inlineEdits/common/dataTypes/documentId';
8
import { StringReplacement } from '../../../util/vs/editor/common/core/edits/stringEdit';
9
import { Position } from '../../../util/vs/editor/common/core/position';
10
import { Range } from '../../../util/vs/editor/common/core/range';
11
import { StringText } from '../../../util/vs/editor/common/core/text/abstractText';
12
import type { CachedEdit } from './nextEditCache';
13
import { NextEditFetchRequest } from './nextEditProvider';
14
15
export interface INextEditDisplayLocation {
16
range: Range;
17
label: string;
18
}
19
20
export interface INextEditResult {
21
requestId: number;
22
result: {
23
edit?: StringReplacement;
24
displayLocation?: INextEditDisplayLocation;
25
targetDocumentId?: DocumentId;
26
isFromCursorJump?: boolean;
27
} | undefined;
28
}
29
30
export class NextEditResult implements INextEditResult {
31
constructor(
32
public readonly requestId: number,
33
public readonly source: NextEditFetchRequest,
34
public readonly result: {
35
edit?: StringReplacement;
36
documentBeforeEdits: StringText;
37
displayLocation?: INextEditDisplayLocation;
38
targetDocumentId?: DocumentId;
39
action?: Command;
40
isFromCursorJump: boolean;
41
jumpToPosition?: Position;
42
isSubsequentEdit: boolean;
43
/**
44
* Reference to the underlying cache entry, when this result was either
45
* served from the cache or freshly produced and immediately cached.
46
* Consumers can use this to read/write per-entry flags such as
47
* {@link CachedEdit.wasRenderedAsInlineSuggestion}.
48
*/
49
cacheEntry?: CachedEdit;
50
} | undefined,
51
) { }
52
}
53
54