Skip to content

Commit 4b2dac3

Browse files
authored
React to breaking changes in Copilot API (#12797)
1 parent 0364ab0 commit 4b2dac3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Diff for: Extension/src/LanguageServer/extension.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,22 @@ import { CppSettings } from './settings';
3333
import { LanguageStatusUI, getUI } from './ui';
3434
import { makeLspRange, rangeEquals, showInstallCompilerWalkthrough } from './utils';
3535

36+
interface CopilotTrait {
37+
name: string;
38+
value: string;
39+
includeInPrompt?: boolean;
40+
promptTextOverride?: string;
41+
}
42+
3643
interface CopilotApi {
3744
registerRelatedFilesProvider(
3845
providerId: { extensionId: string; languageId: string },
39-
callback: (uri: vscode.Uri, token: vscode.CancellationToken) => Promise<{ entries: vscode.Uri[]; traits?: { name: string; value: string }[] }>
40-
): vscode.Disposable;
46+
callback: (
47+
uri: vscode.Uri,
48+
context: { flags: Record<string, unknown> },
49+
cancellationToken: vscode.CancellationToken
50+
) => Promise<{ entries: vscode.Uri[]; traits?: CopilotTrait[] }>
51+
): Disposable;
4152
}
4253

4354
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
@@ -270,7 +281,7 @@ export async function activate(): Promise<void> {
270281
for (const languageId of ['c', 'cpp', 'cuda-cpp']) {
271282
api.registerRelatedFilesProvider(
272283
{ extensionId: util.extensionContext.extension.id, languageId },
273-
async (_uri: vscode.Uri, token: vscode.CancellationToken) =>
284+
async (_uri: vscode.Uri, _context: { flags: Record<string, unknown> }, token: vscode.CancellationToken) =>
274285
({ entries: (await clients.ActiveClient.getIncludes(1, token))?.includedFiles.map(file => vscode.Uri.file(file)) ?? [] })
275286
);
276287
}

0 commit comments

Comments
 (0)