Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ export interface ChatContextResult {
compiler: string;
targetPlatform: string;
targetArchitecture: string;
usedTestFrameworks: string[];
}

interface FolderFilesEncodingChanged {
Expand Down
5 changes: 4 additions & 1 deletion Extension/src/LanguageServer/lmTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTo
contextString += `The project targets the ${chatContext.targetArchitecture} architecture. `;
telemetryProperties["targetArchitecture"] = chatContext.targetArchitecture;
}

if (chatContext.usedTestFrameworks.length > 0) {
contextString += `The project uses the following C++ test frameworks: ${chatContext.usedTestFrameworks.join(', ')}. `;
telemetryProperties["testFrameworks"] = chatContext.usedTestFrameworks.join(', ');
}
return contextString;
}
catch {
Expand Down
19 changes: 12 additions & 7 deletions Extension/test/scenarios/SingleRootProject/tests/lmTool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
});

const arrangeChatContextFromCppTools = ({ chatContextFromCppTools, isCpp, isHeaderFile }:
{ chatContextFromCppTools?: ChatContextResult; isCpp?: boolean; isHeaderFile?: boolean } =
{ chatContextFromCppTools: undefined, isCpp: undefined, isHeaderFile: false }
{ chatContextFromCppTools?: ChatContextResult; isCpp?: boolean; isHeaderFile?: boolean } =
{ chatContextFromCppTools: undefined, isCpp: undefined, isHeaderFile: false }
) => {
activeClientStub.getChatContext.resolves(chatContextFromCppTools);
sinon.stub(util, 'isCpp').returns(isCpp ?? true);
Expand All @@ -145,7 +145,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
standardVersion: 'c++20',
compiler: 'msvc',
targetPlatform: 'windows',
targetArchitecture: 'x64'
targetArchitecture: 'x64',
usedTestFrameworks: ['GTest', 'Catch2']
}
});

Expand All @@ -157,12 +158,14 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
"compiler": 'MSVC',
"standardVersion": 'C++20',
"targetPlatform": 'Windows',
"targetArchitecture": 'x64'
"targetArchitecture": 'x64',
'testFrameworks': 'GTest, Catch2'
})));
ok(result, 'result should not be undefined');
const text = result.content[0] as vscode.LanguageModelTextPart;
ok(text, 'result should contain a text part');
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. ');
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 project uses the following C++ test frameworks: GTest, Catch2. `;
ok(text.value === traits_text);
});

const testGetProjectContext = async ({
Expand All @@ -184,7 +187,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
standardVersion: 'c++20',
compiler: compiler,
targetPlatform: 'windows',
targetArchitecture: 'x64'
targetArchitecture: 'x64',
usedTestFrameworks: []
}
});

Expand Down Expand Up @@ -225,7 +229,8 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
standardVersion: 'gnu++17',
compiler: 'javac',
targetPlatform: 'arduino',
targetArchitecture: 'bar'
targetArchitecture: 'bar',
usedTestFrameworks: []
}
});
const telemetryProperties: Record<string, string> = {};
Expand Down