Skip to content

Commit 86c6c10

Browse files
benmcmorransean-mcmanus
authored andcommitted
React to lmTools API breaking changes (#12866)
1 parent db6e0cb commit 86c6c10

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

Extension/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6451,10 +6451,7 @@
64516451
"userDescription": "%c_cpp.languageModelTools.configuration.userDescription%",
64526452
"modelDescription": "For the active C or C++ file, this tool provides: the language (C, C++, or CUDA), the language standard version (such as C++11, C++14, C++17, or C++20), the compiler (such as GCC, Clang, or MSVC), the target platform (such as x86, x64, or ARM), and the target architecture (such as 32-bit or 64-bit).",
64536453
"icon": "$(file-code)",
6454-
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)",
6455-
"supportedContentTypes": [
6456-
"text/plain"
6457-
]
6454+
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)"
64586455
}
64596456
]
64606457
},

Extension/src/LanguageServer/lmTool.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,10 @@ const knownValues: { [Property in keyof ChatContextResult]?: { [id: string]: str
4444
}
4545
};
4646

47-
const plainTextContentType = 'text/plain';
48-
4947
export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTool<void> {
5048
public async invoke(options: vscode.LanguageModelToolInvocationOptions<void>, token: vscode.CancellationToken): Promise<vscode.LanguageModelToolResult> {
51-
const result: vscode.LanguageModelToolResult = {};
52-
if (options.requestedContentTypes.includes(plainTextContentType)) {
53-
result[plainTextContentType] = await this.getContext(token);
54-
}
55-
return result;
49+
return new vscode.LanguageModelToolResult([
50+
new vscode.LanguageModelTextPart(await this.getContext(token))]);
5651
}
5752

5853
private async getContext(token: vscode.CancellationToken): Promise<string> {

0 commit comments

Comments
 (0)