Skip to content

Commit db1b49a

Browse files
committed
add test framework traits for #cpp
1 parent a93fcf5 commit db1b49a

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
@@ -554,7 +554,7 @@ export interface ChatContextResult {
554554
compiler: string;
555555
targetPlatform: string;
556556
targetArchitecture: string;
557-
testFrameworks: string[];
557+
usedTestFrameworks: string[];
558558
}
559559

560560
interface FolderFilesEncodingChanged {

Extension/src/LanguageServer/lmTool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTo
168168
contextString += `The project targets the ${chatContext.targetArchitecture} architecture. `;
169169
telemetryProperties["targetArchitecture"] = chatContext.targetArchitecture;
170170
}
171-
if (chatContext.testFrameworks) {
172-
contextString += `The project uses the following C++ test frameworks: ${chatContext.testFrameworks.join(', ')} . `;
173-
telemetryProperties["testFrameworks"] = chatContext.testFrameworks.join(',');
171+
if (chatContext.usedTestFrameworks?.length > 0) {
172+
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(', ')} . `;
173+
telemetryProperties["testFrameworks"] = chatContext.usedTestFrameworks.join(',');
174174
}
175175
return contextString;
176176
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
146146
compiler: 'msvc',
147147
targetPlatform: 'windows',
148148
targetArchitecture: 'x64',
149-
testFrameworks: ['gtest', 'catch2']
149+
usedTestFrameworks: ['gtest', 'catch2']
150150
}
151151
});
152152

@@ -164,7 +164,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
164164
ok(result, 'result should not be undefined');
165165
const text = result.content[0] as vscode.LanguageModelTextPart;
166166
ok(text, 'result should contain a text part');
167-
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 .');
167+
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 . `;
168+
ok(text.value === traits_text);
168169
});
169170

170171
const testGetProjectContext = async ({

0 commit comments

Comments
 (0)