Compare commits

...
6 Commits
4 changed files with 28 additions and 15 deletions
+11
View File
@@ -1,5 +1,16 @@
# C/C++ for Visual Studio Code Changelog
## Version 1.22.11: November 5, 2024
### Bug Fixes
* Fix system includes incorrectly being treated as non-system includes when specified with `-I`. [#12842](https://github.com/microsoft/vscode-cpptools/issues/12842)
* Fix inactive region ranges when multi-byte UTF-8 characters are used. [#12879](https://github.com/microsoft/vscode-cpptools/issues/12879)
* Fix formatting with `.editorconfig` files. [#12921](https://github.com/microsoft/vscode-cpptools/issues/12921)
## Version 1.22.10: October 21, 2024
### Bug Fixes
* Fix the 'Extract to Function' feature not working.
* Fix the 'Go to Next/Prev Preprocessor Conditional' feature not working.
## Version 1.22.9: October 14, 2024
### Performance Improvements
* Initialization performance improvements. [#12030](https://github.com/microsoft/vscode-cpptools/issues/12030)
+2 -5
View File
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.22.9-main",
"version": "1.22.11-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
@@ -6451,10 +6451,7 @@
"userDescription": "%c_cpp.languageModelTools.configuration.userDescription%",
"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).",
"icon": "$(file-code)",
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)",
"supportedContentTypes": [
"text/plain"
]
"when": "(config.C_Cpp.experimentalFeatures =~ /^[eE]nabled$/)"
}
]
},
+13 -3
View File
@@ -92,7 +92,17 @@ function parseEditorConfigContent(content: string): Record<string, any> {
const [key, ...values] = line.split('=');
if (key && values.length > 0) {
const trimmedKey = key.trim();
const value = values.join('=').trim();
let value: any = values.join('=').trim();
// Convert boolean-like and numeric values.
if (value.toLowerCase() === 'true') {
value = true;
} else if (value.toLowerCase() === 'false') {
value = false;
} else if (!isNaN(Number(value))) {
value = Number(value);
}
if (currentSection) {
// Ensure the current section is initialized.
if (!config[currentSection]) {
@@ -114,7 +124,7 @@ function getEditorConfig(filePath: string): any {
const rootDir: string = path.parse(currentDir).root;
// Traverse from the file's directory to the root directory.
for (;;) {
for (; ;) {
const editorConfigPath: string = path.join(currentDir, '.editorconfig');
if (fs.existsSync(editorConfigPath)) {
const configFileContent: string = fs.readFileSync(editorConfigPath, 'utf-8');
@@ -139,7 +149,7 @@ function getEditorConfig(filePath: string): any {
});
// Check if the current .editorconfig is the root.
if (configData['*']?.root?.toLowerCase() === 'true') {
if (configData['*']?.root) {
break; // Stop searching after processing the root = true file.
}
}
+2 -7
View File
@@ -44,15 +44,10 @@ const knownValues: { [Property in keyof ChatContextResult]?: { [id: string]: str
}
};
const plainTextContentType = 'text/plain';
export class CppConfigurationLanguageModelTool implements vscode.LanguageModelTool<void> {
public async invoke(options: vscode.LanguageModelToolInvocationOptions<void>, token: vscode.CancellationToken): Promise<vscode.LanguageModelToolResult> {
const result: vscode.LanguageModelToolResult = {};
if (options.requestedContentTypes.includes(plainTextContentType)) {
result[plainTextContentType] = await this.getContext(token);
}
return result;
return new vscode.LanguageModelToolResult([
new vscode.LanguageModelTextPart(await this.getContext(token))]);
}
private async getContext(token: vscode.CancellationToken): Promise<string> {