Skip to content

Commit bc1b741

Browse files
feat: update to latest Copilot LSP
1 parent 3b6ec7d commit bc1b741

File tree

17 files changed

+1479
-629
lines changed

17 files changed

+1479
-629
lines changed

copilot/js/api/types.d.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ export interface ContextProvider<T extends SupportedContextItem> {
5151
selector: DocumentSelector;
5252
resolver: ContextResolver<T>;
5353
}
54+
55+
export type ResolveOnTimeoutResult<T> = T | readonly T[];
56+
export type ResolveResult<T> = Promise<T> | Promise<readonly T[]> | AsyncIterable<T>;
57+
5458
export interface ContextResolver<T extends SupportedContextItem> {
55-
resolve(request: ResolveRequest, token: CancellationToken): Promise<T> | Promise<T[]> | AsyncIterable<T>;
59+
resolve(request: ResolveRequest, token: CancellationToken): ResolveResult<T>;
60+
// Optional method to be invoked if the request timed out. This requests additional context items.
61+
resolveOnTimeout?(request: ResolveRequest): ResolveOnTimeoutResult<T> | undefined;
5662
}
5763

5864
/**
@@ -86,20 +92,29 @@ export type ContextUsageStatistics = {
8692
usageDetails?: ContextItemUsageDetails[];
8793
};
8894

95+
export type ProposedTextEdit = TextEdit & {
96+
positionAfterEdit: Position;
97+
// Indicates whether the edit is suggested by the IDE. Otherwise it's assumed to be speculative
98+
source?: 'selectedCompletionInfo';
99+
};
100+
89101
export interface DocumentContext {
90102
uri: DocumentUri;
91103
languageId: string;
92104
version: number;
105+
// Position and offset are relative to the provided version of the document.
106+
// The position after an edit is applied is found in ProposedTextEdit.positionAfterEdit.
93107
/**
94108
* @deprecated Use `position` instead.
95109
*/
96110
offset: number;
97111
position: Position;
98-
proposedEdits?: TextEdit[];
112+
proposedEdits?: ProposedTextEdit[];
99113
}
100114
export interface ResolveRequest {
101115
// A unique ID to correlate the request with the completion request.
102116
completionId: string;
117+
opportunityId: string;
103118
documentContext: DocumentContext;
104119

105120
activeExperiments: Map<string, string | number | boolean | string[]>;
@@ -109,9 +124,16 @@ export interface ResolveRequest {
109124
* After the time budget runs out, the request will be cancelled via the CancellationToken.
110125
* Providers can use this value as a hint when computing context. Providers should expect the
111126
* request to be cancelled once the time budget runs out.
127+
*
128+
* @deprecated Use `timeoutEnd` instead.
112129
*/
113130
timeBudget: number;
114131

132+
/**
133+
* Unix timestamp representing the exact time the request will be cancelled via the CancellationToken.
134+
*/
135+
timeoutEnd: number;
136+
115137
/**
116138
* Various statistics about the last completion request. This can be used by the context provider
117139
* to make decisions about what context to provide for the current call.

copilot/js/bin/darwin/arm64/rg

3.42 MB
Binary file not shown.

copilot/js/bin/darwin/x64/rg

4.17 MB
Binary file not shown.

copilot/js/bin/linux/arm64/rg

3.92 MB
Binary file not shown.

copilot/js/bin/linux/x64/rg

5.04 MB
Binary file not shown.

copilot/js/bin/win32/arm64/rg.exe

4.05 MB
Binary file not shown.

copilot/js/bin/win32/x64/rg.exe

4.7 MB
Binary file not shown.

copilot/js/crypt32-arm64.node

147 KB
Binary file not shown.

copilot/js/crypt32.node

13.5 KB
Binary file not shown.

copilot/js/diffWorker.js

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)