diff --git a/CHANGELOG.md b/CHANGELOG.md index 982e0177a..d6f4566b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Improvements: - Embed the source commit SHA as a `commitId` field in the packaged extension's `package.json` so the exact commit a (pre-)release was built from can be identified, since the marketplace version number alone cannot be traced back to a commit. [#4801](https://github.com/microsoft/vscode-cmake-tools/issues/4801) Bug Fixes: +- Fix CMake syntax highlighting treating escaped `$<` sequences in quoted regex strings as generator expressions. [#5028](https://github.com/microsoft/vscode-cmake-tools/issues/5028) - Fix a test run that matched no tests being reported as success. When specific tests are requested (e.g. programmatically via the API/Copilot) but none match a discovered test — for example an agent passing a partial or non-existent test name — CTest exits 0 ("No tests were found!!!"), which callers could misread as "all tests passed". Such runs now return a failure with a clear message when tests exist but the requested ones weren't found. [#4915](https://github.com/microsoft/vscode-cmake-tools/issues/4915) - Stop showing "Adding a file without a valid code model" / "Deleting a file without a valid code model" warning notifications when a source file is automatically added or deleted and there is no valid CMake code model (for example when using clangd with the C/C++ IntelliSense engine disabled, or before the project has been configured). The automatic list-file update now stays silent in this case; the warning is only shown when the update is explicitly invoked via the "CMake: Add new source file" / "CMake: Remove deleted source file" commands. [#5009](https://github.com/microsoft/vscode-cmake-tools/issues/5009) - Fix running a single test from the inline Test CodeLens or the project outline building the default (or all) target instead of the test's own executable; single-test runs now build only that test's target. diff --git a/syntaxes/CMake.tmLanguage.json b/syntaxes/CMake.tmLanguage.json index 5bbc791c7..6c8a20764 100644 --- a/syntaxes/CMake.tmLanguage.json +++ b/syntaxes/CMake.tmLanguage.json @@ -105,8 +105,9 @@ "endCaptures": { "0": { "name": "punctuation.definition.string.end.cmake" } } }, "generatorExpression": { + "comment": "Do not start a generator expression at escaped $< sequences, such as CMake regex patterns matching a literal generator expression prefix.", "name": "meta.generator-expression.cmake", - "begin": "\\$<", + "begin": "(?", "endCaptures": { "0": { "name": "punctuation.definition.generator-expression.end.cmake" } }, @@ -412,4 +413,4 @@ "match": "\\b(?i:return)\\b" } } -} \ No newline at end of file +} diff --git a/test/visual-syntax-test/CMakeLists.txt b/test/visual-syntax-test/CMakeLists.txt index 86cb9c55f..283a42c77 100644 --- a/test/visual-syntax-test/CMakeLists.txt +++ b/test/visual-syntax-test/CMakeLists.txt @@ -49,6 +49,16 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20") message(STATUS "CMake 3.20+") endif() +# Issue #5028: Fix highlighting of escaped $< in CMake regex strings +function(validate_configure_path value description) + if("${value}" MATCHES "\\$<") + message(FATAL_ERROR + "${description} must be known at configure time; generator expressions " + "are not supported." + ) + endif() +endfunction() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") message(STATUS "Linux") elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -471,4 +481,4 @@ set_target_properties(MyLib PROPERTIES SOURCES "lib.cpp" COMPILE_DEFINITIONS_DEBUG "DEBUG=1" LINK_FLAGS_RELEASE "/OPT:REF" -) \ No newline at end of file +)