Skip to content

Commit

Permalink
Support C89 in Completion Prompts (#13132)
Browse files Browse the repository at this point in the history
- Also send unrecognized ones in telementry for further ananlysis.
  • Loading branch information
kuchungmsft authored Jan 8, 2025
1 parent 200f093 commit 8e5bbf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Extension/src/LanguageServer/lmTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const knownValues: { [Property in keyof ChatContextResult]?: { [id: string]: str
'c++17': 'C++17',
'c++20': 'C++20',
'c++23': 'C++23',
'c90': "C90",
'c89': "C89",
'c99': "C99",
'c11': "C11",
'c17': "C17",
Expand Down Expand Up @@ -140,6 +140,8 @@ export async function getProjectContext(uri: vscode.Uri, context: { flags: Recor
return undefined;
}

const originalStandardVersion = projectContext.result.standardVersion;

formatChatContext(projectContext.result);

const result: ProjectContext = {
Expand All @@ -160,6 +162,11 @@ export async function getProjectContext(uri: vscode.Uri, context: { flags: Recor
if (projectContext.result.standardVersion) {
telemetryProperties["standardVersion"] = projectContext.result.standardVersion;
}
else {
if (originalStandardVersion) {
telemetryProperties["originalStandardVersion"] = originalStandardVersion;
}
}
if (projectContext.result.targetPlatform) {
telemetryProperties["targetPlatform"] = projectContext.result.targetPlatform;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ describe('CppConfigurationLanguageModelTool Tests', () => {
property['language'] === undefined &&
property['compiler'] === undefined &&
property['standardVersion'] === undefined &&
property['originalStandardVersion'] === 'gnu++17' &&
property['targetPlatform'] === undefined)));
ok(result, 'result should not be undefined');
ok(result.language === '');
Expand Down

0 comments on commit 8e5bbf1

Please sign in to comment.