Skip to content

Commit 2b73262

Browse files
committed
add test framework traits for #cpp
1 parent f21bff8 commit 2b73262

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ export interface ChatContextResult {
553553
compiler: string;
554554
targetPlatform: string;
555555
targetArchitecture: string;
556-
testFrameworks: string[];
556+
usedTestFrameworks: string[];
557557
}
558558

559559
export interface FileContextResult {

Extension/src/LanguageServer/lmTool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTo
235235
contextString += `The project targets the ${chatContext.targetArchitecture} architecture. `;
236236
telemetryProperties["targetArchitecture"] = chatContext.targetArchitecture;
237237
}
238-
if (chatContext.testFrameworks) {
239-
contextString += `The project uses the following C++ test frameworks: ${chatContext.testFrameworks.join(', ')} . `;
240-
telemetryProperties["testFrameworks"] = chatContext.testFrameworks.join(',');
238+
if (chatContext.usedTestFrameworks?.length > 0) {
239+
contextString += `The active document contains the content of the file '${currentDoc.fileName}' which is located in a directory structure where other files are including headers for the following C++ test frameworks: ${chatContext.usedTestFrameworks.join(', ')} . `;
240+
telemetryProperties["testFrameworks"] = chatContext.usedTestFrameworks.join(',');
241241
}
242242
return contextString;
243243
}

Extension/test/scenarios/SingleRootProject/tests/lmTool.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
155155
compiler: 'msvc',
156156
targetPlatform: 'windows',
157157
targetArchitecture: 'x64',
158-
testFrameworks: ['gtest', 'catch2']
158+
usedTestFrameworks: ['gtest', 'catch2']
159159
}
160160
});
161161

@@ -173,7 +173,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
173173
ok(result, 'result should not be undefined');
174174
const text = result.content[0] as vscode.LanguageModelTextPart;
175175
ok(text, 'result should contain a text part');
176-
ok(text.value === 'The user is working on a C++ project. The project uses language version C++20. The project compiles using the MSVC compiler. The project targets the Windows platform. The project targets the x64 architecture. The project uses the following C++ test frameworks: gtest, catch2 .');
176+
const traits_text = `The user is working on a C++ project. The project uses language version C++20. The project compiles using the MSVC compiler. The project targets the Windows platform. The project targets the x64 architecture. The active document contains the content of the file 'undefined' which is located in a directory structure where other files are including headers for the following C++ test frameworks: gtest, catch2 . `;
177+
ok(text.value === traits_text);
177178
});
178179

179180
const testGetProjectContext = async ({

0 commit comments

Comments
 (0)