From 7bafd64cfeb345cb60b75ff36d06d643f7720d36 Mon Sep 17 00:00:00 2001 From: Colen Garoutte-Carson <49173979+Colengms@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:08:15 -0800 Subject: [PATCH 1/2] Fix processing of bools and numbers in editorConfig files (#12923) --- Extension/src/LanguageServer/editorConfig.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Extension/src/LanguageServer/editorConfig.ts b/Extension/src/LanguageServer/editorConfig.ts index 1ac8452b46..21a73673c6 100644 --- a/Extension/src/LanguageServer/editorConfig.ts +++ b/Extension/src/LanguageServer/editorConfig.ts @@ -92,7 +92,17 @@ function parseEditorConfigContent(content: string): Record { 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. } } From 23b0672837d8d0f59d929c51db351e51b9ba68a2 Mon Sep 17 00:00:00 2001 From: Sean McManus Date: Tue, 5 Nov 2024 14:44:40 -0800 Subject: [PATCH 2/2] Cherry-pick and update version and changelog for 1.22.11. --- Extension/CHANGELOG.md | 6 ++++++ Extension/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index d8a2f36bba..9e13fd1eac 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -1,5 +1,11 @@ # 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. diff --git a/Extension/package.json b/Extension/package.json index 8674cf9db1..e6643aa695 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -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",