Compare commits

...
19 changed files with 111 additions and 117 deletions
+7 -2
View File
@@ -5,7 +5,7 @@
import * as fs from "fs";
import * as path from 'path';
import { parseString } from 'xml2js';
import { mkdir, write } from './common';
import { glob, mkdir, write } from './common';
export async function main() {
@@ -45,11 +45,16 @@ export async function main() {
const locFolderNames = fs.readdirSync(localizeRepoPath).filter(f => fs.lstatSync(path.join(localizeRepoPath, f)).isDirectory());
for (const locFolderName of locFolderNames) {
const lclPath = path.join(localizeRepoPath, locFolderName, "vc/vc/cpfeui.dll.lcl");
const languageInfo = languages.find(l => l.folderName === locFolderName);
if (!languageInfo) {
return;
}
const localePath = path.join(localizeRepoPath, locFolderName);
const lclPaths = await glob("vc/vc/cpfeui.dll.lcl", { cwd: localePath, nocase: true, nodir: true });
if (lclPaths.length !== 1) {
throw new Error(`Expected one cpfeui.dll.lcl under '${localePath}', found ${lclPaths.length}.`);
}
const lclPath = path.join(localePath, lclPaths[0]);
const languageId = languageInfo.id;
const outputLanguageFolder = path.join(cpptoolsRepoPath, "Extension/bin/messages", languageId);
const outputPath = path.join(outputLanguageFolder, "messages.json");
+33 -71
View File
@@ -1,93 +1,55 @@
# C/C++ for Visual Studio Code Changelog
## Version 1.33.7: August 11, 2026
### Bug Fixes
* Fix another crash when reading files saved in certain multibyte encodings such as GB18030 or EUC-JP.
* Fix newly created files not being associated with the correct configuration in the browse database.
* Fix the language server becoming unresponsive during browse database initialization.
* Fix stale diagnostics and missing code actions after editing visible headers.
* Fix `/ZW:nostdlib` not being processed correctly by IntelliSense.
* Update dependencies.
## Version 1.33.6: August 4, 2026
### Bug Fixes
* Fix a spurious recursive includes (`**`) debug console log warning for paths merged from `c_cpp_properties.json` when `C_Cpp.mergeConfigurations` is enabled. [#14125](https://github.com/microsoft/vscode-cpptools/issues/14125)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14620](https://github.com/microsoft/vscode-cpptools/pull/14620)
* Fix custom configurations being discarded when `C_Cpp.mergeConfigurations` is enabled and a provider supplies the file `uri` as a `vscode.Uri`. [#14621](https://github.com/microsoft/vscode-cpptools/issues/14621)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14624](https://github.com/microsoft/vscode-cpptools/pull/14624)
* Fix a tag parser crash when a UTF-8 string literal is concatenated with a narrow string literal containing an invalid multibyte sequence.
* Fix potential browse database corruption when the same workspace is opened by multiple processes on Linux and macOS.
* Fix a crash when reading files saved in certain multibyte encodings such as GB18030 or EUC-JP.
* Fix an incorrect file path in an error message on Windows.
* Other potential crash fixes.
* Update dependencies.
## Version 1.33.5: July 28, 2026
### Bug Fixes
* Fix the remote process picker `ps` command not working with some shells. [#14442](https://github.com/microsoft/vscode-cpptools/issues/14442)
* Thanks for the contribution. [@HuzaifaAbdulRehman](https://github.com/HuzaifaAbdulRehman) [PR #14592](https://github.com/microsoft/vscode-cpptools/pull/14592)
* Fix a spurious IntelliSense error with class template argument deduction (CTAD). [#14453](https://github.com/microsoft/vscode-cpptools/issues/14453), [#14459](https://github.com/microsoft/vscode-cpptools/issues/14459), [#14504](https://github.com/microsoft/vscode-cpptools/issues/14504)
* Fix 'Run C/C++ File' not running the program in PowerShell when terminal shell integration is unavailable. [#14583](https://github.com/microsoft/vscode-cpptools/issues/14583)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14585](https://github.com/microsoft/vscode-cpptools/pull/14585)
* Fix the build tools walkthrough for Visual Studio 2026. [PR #14589](https://github.com/microsoft/vscode-cpptools/pull/14589)
* Fix empty database folders being created in every folder of a multi-root workspace.
* Fix 'Rescan Workspace' triggering a full database reset instead of only a rescan.
* Fix several potential deadlocks and data races in the language server.
* Reduce memory usage to help avoid out-of-memory crashes.
* Fix an incorrect `#include` casing error on Linux.
* Fix an IntelliSense crash.
* Various localization updates.
* Update dependencies.
## Version 1.33.4: July 8, 2026
### Bug Fixes
* Fix the wording for the `#include` errors detected message. [#8227](https://github.com/microsoft/vscode-cpptools/issues/8227)
* Fix another "directory_cache" crash.
* Update some localization.
## Version 1.33.3: July 6, 2026
### Enhancement
* Allow platform overrides in `cppbuild` tasks. [#11601](https://github.com/microsoft/vscode-cpptools/issues/11601)
### Bug Fixes
* Fix `[[no_unique_address]]` empty-base layout `sizeof` being computed too large. [#14524](https://github.com/microsoft/vscode-cpptools/issues/14524)
* Fix C/C++ debug data-tips on members of a dereferenced expression. [PR #14540](https://github.com/microsoft/vscode-cpptools/pull/14540)
* Thanks for the contribution. [@tieo](https://github.com/tieo)
* Fix `clang-format`/`clang-tidy` version check failing on Windows. [PR #14552](https://github.com/microsoft/vscode-cpptools/pull/14552)
* Fix Windows backslash paths being mangled when adding an SSH target. [PR #14554](https://github.com/microsoft/vscode-cpptools/pull/14554)
* Fix "directory_cache" crashes.
* Fix spurious IntelliSense error on `std::variant` brace-initialization.
## Version 1.33.2: June 26, 2026
### Bug Fixes
* Fix a regression with 'Find All References' with functions that exist in both C and C++ files. [#14546](https://github.com/microsoft/vscode-cpptools/issues/14546)
## Version 1.33.1: June 23, 2026
### Bug Fixes
* Fix 'Find All References' dropping valid references when a template parameter type has a typedef alias in only one translation unit. [#14344](https://github.com/microsoft/vscode-cpptools/issues/14344)
* Fix a crash regression on file open.
* Fix IntelliSense incorrectly resolving `#include` files through a symbolic link after the target directory was deleted from disk.
* Fix "tag parsing finished" status randomly getting reported too soon after a 'Reset IntelliSense Database' command.
## Version 1.33.0: June 22, 2026
## Version 1.33.8: August 17, 2026
### New Feature
* Unification of tag parsing with the VS implementation. In particular, it's now done using multiple parallel `cpptools-srv2` processes. [PR #14426](https://github.com/microsoft/vscode-cpptools/pull/14426)
### Enhancements
* Allow platform overrides in `cppbuild` tasks. [#11601](https://github.com/microsoft/vscode-cpptools/issues/11601)
* Add the `debuginfod` launch option to the `cppdbg` debugger schema. [#14458](https://github.com/microsoft/vscode-cpptools/issues/14458), [#14460](https://github.com/microsoft/vscode-cpptools/issues/14460), [PR #14471](https://github.com/microsoft/vscode-cpptools/pull/14471), [PR #14506](https://github.com/microsoft/vscode-cpptools/pull/14506), [MIEngine#1562](https://github.com/microsoft/MIEngine/issues/1562)
* Add the `ignoreRunWithoutDebuggingWarnings` property to allow 'Run without debugging' warnings to be suppressed. [#14515](https://github.com/microsoft/vscode-cpptools/issues/14515)
* Various localization updates.
### Bug Fixes
* Fix the wording for the `#include` errors detected message. [#8227](https://github.com/microsoft/vscode-cpptools/issues/8227)
* Fix an incorrect `invalid type conversion` IntelliSense error. [#11294](https://github.com/microsoft/vscode-cpptools/issues/11294)
* Fix include completion (with recursive includes) still suggesting headers from a deleted folder. [#12636](https://github.com/microsoft/vscode-cpptools/issues/12636)
* Fix a spurious recursive includes (`**`) debug console log warning for paths merged from `c_cpp_properties.json` when `C_Cpp.mergeConfigurations` is enabled. [#14125](https://github.com/microsoft/vscode-cpptools/issues/14125)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14620](https://github.com/microsoft/vscode-cpptools/pull/14620)
* Fix 'Find All References' dropping valid references when a template parameter type has a typedef alias in only one translation unit. [#14344](https://github.com/microsoft/vscode-cpptools/issues/14344)
* Fix the remote process picker `ps` command not working with some shells. [#14442](https://github.com/microsoft/vscode-cpptools/issues/14442)
* Thanks for the contribution. [@HuzaifaAbdulRehman](https://github.com/HuzaifaAbdulRehman) [PR #14592](https://github.com/microsoft/vscode-cpptools/pull/14592)
* Fix a spurious IntelliSense error with class template argument deduction (CTAD). [#14453](https://github.com/microsoft/vscode-cpptools/issues/14453), [#14459](https://github.com/microsoft/vscode-cpptools/issues/14459), [#14504](https://github.com/microsoft/vscode-cpptools/issues/14504)
* Add `important` to `C_Cpp.doxygen.sectionTags`. [PR #14473](https://github.com/microsoft/vscode-cpptools/pull/14473)
* Update the minimum supported VS Code version to 1.77. [PR #14502](https://github.com/microsoft/vscode-cpptools/pull/14502)
* Fix issues with the debugger `launch.json` schema. [PR #14523](https://github.com/microsoft/vscode-cpptools/pull/14523)
* Fix `[[no_unique_address]]` empty-base layout `sizeof` being computed too large. [#14524](https://github.com/microsoft/vscode-cpptools/issues/14524)
* Fix `${env:VAR}` and `${env.VAR}` not expanding to an empty string when the environment variable is unset, to match VS Code's behavior. [PR #14535](https://github.com/microsoft/vscode-cpptools/pull/14535)
* Thanks for the contribution. [@notable-equivalent](https://github.com/notable-equivalent)
* Fix C/C++ debug data-tips on members of a dereferenced expression. [PR #14540](https://github.com/microsoft/vscode-cpptools/pull/14540)
* Thanks for the contribution. [@tieo](https://github.com/tieo)
* Fix Windows backslash paths being mangled when adding an SSH target. [PR #14554](https://github.com/microsoft/vscode-cpptools/pull/14554)
* Fix 'Run C/C++ File' not running the program in PowerShell when terminal shell integration is unavailable. [#14583](https://github.com/microsoft/vscode-cpptools/issues/14583)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14585](https://github.com/microsoft/vscode-cpptools/pull/14585)
* Fix the build tools walkthrough for Visual Studio 2026. [PR #14589](https://github.com/microsoft/vscode-cpptools/pull/14589)
* Fix custom configurations being discarded when `C_Cpp.mergeConfigurations` is enabled and a provider supplies the file `uri` as a `vscode.Uri`. [#14621](https://github.com/microsoft/vscode-cpptools/issues/14621)
* Thanks for the contribution. [@owevertonguedes (Weverton Guedes)](https://github.com/owevertonguedes) [PR #14624](https://github.com/microsoft/vscode-cpptools/pull/14624)
* Fix a tag parser crash when a UTF-8 string literal is concatenated with a narrow string literal containing an invalid multibyte sequence.
* Fix IntelliSense incorrectly resolving `#include` files through a symbolic link after the target directory was deleted from disk.
* Fix potential browse database corruption when the same workspace is opened by multiple processes on Linux and macOS.
* Fix crashes when reading files saved in certain multibyte encodings such as GB18030 or EUC-JP.
* Fix empty database folders being created in every folder of a multi-root workspace.
* Fix the `C_Cpp.refactoring.includeHeader` setting not honoring `always`.
* Fix spurious IntelliSense error on `std::variant` brace-initialization.
* Fix several potential deadlocks and data races in the language server.
* Fix an incorrect file path in an error message on Windows.
* Reduce memory usage to help avoid out-of-memory crashes.
* Fix stale diagnostics after editing visible headers.
* Fix several crashes in the recursive include cache.
* Fix an incorrect `#include` casing error on Linux.
* Various other fixes found internally.
* Various localization updates.
* Fix an IntelliSense crash.
* Update dependencies.
## Version 1.32.2: April 28, 2026
### New Feature
+2 -3
View File
@@ -2999,7 +2999,7 @@
"Přiřazení k anachronizmu this není kompatibilní s režimem C++11.",
"Došlo k neznámé chybě. Soubor PCH IntelliSense se nevygeneroval.",
"Nejméně jednu ze vzdálených cest nejde namapovat na stávající místní cesty. Funkce IntelliSense možná nebude fungovat zcela podle očekávání.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"„static“ je zde nestandardní",
"%nd byl dříve deklarován bez explicitního základu výčtu",
"Chybějící typename je tady nestandardní.",
"Zkrácená syntaxe šablony funkce není standardní pro vodítka dedukce",
"too many nested user-defined conversions (possible cycle of converting routines)"
"Zkrácená syntaxe šablony funkce není standardní pro vodítka dedukce"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"Die Zuweisung zum this-Anachronismus ist mit dem C++11-Modus nicht kompatibel.",
"Unbekannter Fehler. Es wurde keine IntelliSense PCH-Datei generiert.",
"Mindestens ein Remotepfad kann vorhandenen lokalen Pfaden nicht zugeordnet werden. Die IntelliSense-Funktionen werden ggf. beeinträchtigt.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"„static“ entspricht hier nicht dem Standard",
"%nd wurde zuvor ohne explizite Enumerationsbasis deklariert",
"Fehlender „typename“ entspricht hier nicht dem Standard.",
"Die abgekürzte Funktionsvorlagensyntax entspricht nicht dem Standard für Deduktionsleitfäden.",
"too many nested user-defined conversions (possible cycle of converting routines)"
"Die abgekürzte Funktionsvorlagensyntax entspricht nicht dem Standard für Deduktionsleitfäden."
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"la asignación al anacronismo \"this\" no es compatible con el modo C++11",
"error desconocido. No se generó un archivo IntelliSense PCH.",
"No se pueden asignar una o varias rutas remotas a las rutas locales actuales. La experiencia con IntelliSense puede degradarse.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"\"static\" no es estándar aquí",
"%nd se declaró previamente sin una base explícita de enumeración",
"falta 'typename' no estándar aquí",
"La sintaxis abreviada de las plantillas de funciones no es estándar para las guías de deducción",
"too many nested user-defined conversions (possible cycle of converting routines)"
"La sintaxis abreviada de las plantillas de funciones no es estándar para las guías de deducción"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"l'assignation à l'anachronisme 'this' n'est pas compatible avec le mode C++11",
"une erreur inconnue s'est produite. Aucun fichier PCH IntelliSense n'a été généré.",
"Impossible de mapper un ou plusieurs chemins distants à des chemins locaux existants. L'expérience IntelliSense risque d'être dégradée.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"« static » nest pas standard ici",
"%nd a été déclaré précédemment sans base d’énumération explicite",
"le mot-clé « typename » manquant nest pas standard ici",
"la syntaxe abrégée du modèle de fonction nest pas standard pour les guides de déduction",
"too many nested user-defined conversions (possible cycle of converting routines)"
"la syntaxe abrégée du modèle de fonction nest pas standard pour les guides de déduction"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"l'assegnazione all'anacronismo 'this' non è compatibile con la modalità C++11",
"si è verificato un errore sconosciuto. Non è stato generato alcun file PCH IntelliSense.",
"Non è possibile eseguire il mapping di uno o più percorsi remoti a percorsi locali esistenti. L'operazione potrebbe influire negativamente sull'esperienza IntelliSense.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"'static' non è standard qui",
"%nd era stato dichiarato in precedenza senza una base di enumerazione esplicita",
"manca 'typename' che qui non è standard",
"la sintassi abbreviata del modello di funzione non è standard per le guide alla deduzione",
"too many nested user-defined conversions (possible cycle of converting routines)"
"la sintassi abbreviata del modello di funzione non è standard per le guide alla deduzione"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"'this' への代入 (旧形式) は C++11 モードと互換性がありません",
"不明なエラーが発生しました。IntelliSense PCH ファイルは生成されませんでした。",
"1 つ以上のリモート パスを既存のローカル パスにマップできません。IntelliSense の機能が低下する可能性があります。",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"'static' はここでは非標準です",
"%nd は、明示的な列挙型ベースなしで以前に宣言されました",
"見つからない 'typename' はここでは非標準です",
"省略形の関数テンプレート構文は、推論ガイドでは非標準です",
"too many nested user-defined conversions (possible cycle of converting routines)"
"省略形の関数テンプレート構文は、推論ガイドでは非標準です"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"'this'에 대한 할당(오래된 구문)은 C++11 모드와 호환되지 않습니다.",
"알 수 없는 오류가 발생했습니다. IntelliSense PCH 파일이 생성되지 않았습니다.",
"하나 이상의 원격 경로를 기존 로컬 경로에 매핑할 수 없습니다. IntelliSense 성능이 저하될 수 있습니다.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"여기서 'static'은 표준이 아닙니다.",
"%nd은(는) 이전에 명시적 열거형 기반 없이 선언되었습니다.",
"여기서 누락된 'typename'이 표준이 아닙니다.",
"약식 함수 템플릿 구문은 추론 가이드에 대한 표준이 아닙니다.",
"too many nested user-defined conversions (possible cycle of converting routines)"
"약식 함수 템플릿 구문은 추론 가이드에 대한 표준이 아닙니다."
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"przypisanie do przestarzałej konstrukcji „this” nie jest zgodne z trybem C++11",
"wystąpił nieznany błąd. Nie wygenerowano pliku PCH funkcji IntelliSense.",
"Nie można zamapować co najmniej jednej ścieżki zdalnej na istniejące ścieżki lokalne. Może to mieć negatywny wpływ na działanie funkcji IntelliSense.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"„static” jest tutaj niestandardowy",
"funkcja %nd została poprzednio zadeklarowana bez jawnej bazy wyliczenia",
"brak elementu „typename” jest tutaj niestandardowe",
"skrócona składnia szablonu funkcji jest niestandardowa dla przewodników dedukcji",
"too many nested user-defined conversions (possible cycle of converting routines)"
"skrócona składnia szablonu funkcji jest niestandardowa dla przewodników dedukcji"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"a atribuição ao anacronismo 'this' não é compatível com o modo C++11",
"erro desconhecido. Não foi gerado um arquivo PCH do IntelliSense.",
"Um ou mais caminhos remotos não podem ser mapeados para os caminhos locais existentes. A experiência do IntelliSense pode ser degradada.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"\"static\" não é padrão aqui",
"%nd foi declarado anteriormente sem uma base de enumeração explícita",
"\"typename\" ausente não é padrão aqui",
"a sintaxe abreviada de template de função é não padrão para guias de dedução",
"too many nested user-defined conversions (possible cycle of converting routines)"
"a sintaxe abreviada de template de função é não padrão para guias de dedução"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"назначение устаревшему элементу this несовместимо с режимом C++11",
"произошла неизвестная ошибка. PCH-файл IntelliSense не был создан.",
"Один или несколько удаленных путей не могут быть сопоставлены с существующими локальными путями. Использование IntelliSense может быть ограничено.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"\"static\" является здесь нестандартным",
"%nd ранее был объявлен без явной базы перечисления",
"отсутствие typename здесь является нестандартным",
"сокращенный синтаксис шаблона функции не является стандартным для правил дедукции",
"too many nested user-defined conversions (possible cycle of converting routines)"
"сокращенный синтаксис шаблона функции не является стандартным для правил дедукции"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"'this' anakronizmine yönelik atama C++11 modu ile uyumlu değil",
"bilinmeyen bir hata oluştu. IntelliSense PCH dosyası oluşturulmadı.",
"Bir veya daha fazla uzak yol, mevcut yerel yollarla eşlenemiyor. IntelliSense deneyimi bozulabilir.",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"'static' burada standart dışıdır",
"%nd daha önce açık bir sabit liste tabanı olmadan tanımlanmıştı",
"eksik 'typename' burada standart dışı",
"kısaltılmış işlev şablonu sözdizimi çıkarsama kılavuzları için standart değil",
"too many nested user-defined conversions (possible cycle of converting routines)"
"kısaltılmış işlev şablonu sözdizimi çıkarsama kılavuzları için standart değil"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"对 \"this\" 计时错误的赋值与 C++11 模式不兼容",
"出现了未知错误。未生成 IntelliSense PCH 文件。",
"一个或多个远程路径无法映射到现有本地路径。IntelliSense 体验可能会降级。",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"此处使用 \"static\" 不符合标准",
"之前声明 %nd 时未指定显式枚举基类型",
"此处缺少 'typename' 属于非标准用法",
"缩写函数模板语法对于推导指南是不标准的",
"too many nested user-defined conversions (possible cycle of converting routines)"
"缩写函数模板语法对于推导指南是不标准的"
]
+2 -3
View File
@@ -2999,7 +2999,7 @@
"'this' 用法已過時,且這種指派與 C++11 模式不相容",
"發生未知的錯誤。未產生 IntelliSense PCH 檔案。",
"有一或多個遠端路徑無法對應到現有的本機路徑。IntelliSense 的效能可能會變差。",
null,
"too many nested user-defined conversions (possible cycle of converting routines)",
null,
null,
null,
@@ -3747,6 +3747,5 @@
"此處使用的 'static' 非標準",
"%nd 先前宣告時未明確指定的列舉基底",
"此處缺少 'typename' 非標準用法",
"簡化函式範本語法在推導指南中並非標準用法",
"too many nested user-defined conversions (possible cycle of converting routines)"
"簡化函式範本語法在推導指南中並非標準用法"
]
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.33.7-main",
"version": "1.33.8-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
@@ -14,6 +14,7 @@ import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as which from 'which';
import { logAndReturn, returns } from '../Utility/Async/returns';
import { escapePathForSquiggles } from '../Utility/Text/escape';
import * as util from '../common';
import { isWindows } from '../constants';
import { getOutputChannelLogger } from '../logger';
@@ -2119,10 +2120,8 @@ export class CppProperties {
continue;
}
// Escape the path string for literal use in a regular expression
// Need to escape any quotes to match the original text
let escapedPath: string = curPath.replace(/"/g, '\\"');
escapedPath = escapedPath.replace(/[-\"\/\\^$*+?.()|[\]{}]/g, '\\$&');
// Escape the parsed path for a literal regex match against its JSON spelling.
const escapedPath: string = escapePathForSquiggles(curPath);
// Create a pattern to search for the path with either a quote or semicolon immediately before and after,
// and extend that pattern to the next quote before and next quote after it.
+9
View File
@@ -0,0 +1,9 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
export function escapePathForSquiggles(s: string): string {
return s.replace(/[-"\/\\^$*+?.()|[\]{}]/g, (character: string): string =>
character === '"' ? '\\\\"' : `\\${character}`);
}
+32
View File
@@ -0,0 +1,32 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { describe, it } from 'mocha';
import { doesNotMatch, match, strictEqual } from 'node:assert';
import { escapePathForSquiggles } from '../../src/Utility/Text/escape';
describe('Text escaping', () => {
it('escapes paths for matching their JSON spelling', () => {
strictEqual(escapePathForSquiggles('"'), '\\\\"');
strictEqual(escapePathForSquiggles('\\'), '\\\\');
strictEqual(escapePathForSquiggles('.*'), '\\.\\*');
const parsedPath: string = String.raw`C:\src"quoted"`;
const sourcePath: string = String.raw`C:\src\"quoted\"`;
const pattern: RegExp = new RegExp(`^${escapePathForSquiggles(parsedPath)}$`);
match(sourcePath, pattern);
doesNotMatch(parsedPath, pattern);
});
it('handles repeated backslashes and regex metacharacters', () => {
const parsedPath: string = String.raw`C:\\sdk\\[headers]+(x)?.h\\say"hello"and"goodbye`;
const sourcePath: string = String.raw`C:\\sdk\\[headers]+(x)?.h\\say\"hello\"and\"goodbye`;
const pattern: RegExp = new RegExp(`^${escapePathForSquiggles(parsedPath)}$`);
match(sourcePath, pattern);
doesNotMatch(String.raw`C:\sdk\[headers]+(x)?.h\say\"hello\"and\"goodbye`, pattern);
doesNotMatch(String.raw`C:\\sdk\\headers+(x)?.h\\say\"hello\"and\"goodbye`, pattern);
});
});