Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

This changes visible behavior

Test Explorer now preserves expand/collapse state when running tests with cmake.ctest.testSuiteDelimiter enabled.

The following changes are proposed:

  • Preserve TestItem object identity: Replace unconditional testExplorerRoot.children.replace([]) with selective updates. VS Code tracks UI state by object identity, not ID.
  • Reuse existing items: Check children.get(id) before creating new TestItems in both createTestItemAndSuiteTree() and refreshTestsInTestExplorer()
  • Update properties on reuse: Refresh label, uri, range, and tags. Clear stale values when undefined.
  • Remove obsolete items: Track valid test IDs, delete top-level items no longer present in test list

Other Notes/Information

Limitation: Nested tests removed from suites remain until parent suite removal. Full recursive cleanup deferred for complexity.

Security: CodeQL scan clean (0 alerts)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 2wrvsblobprodwus2180.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • 40vvsblobprodwus2135.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • b15vsblobprodwus2164.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • b53vsblobprodwus2154.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • d94vsblobprodwus2119.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • k4pvsblobprodwus2140.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • n6wvsblobprodwus2123.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • p2tvsblobprodwus2189.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)
  • v41vsblobprodwus2175.vsblob.vsassets.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/yarn install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] Test explorer tree expand / collapse are reset when running test</issue_title>
<issue_description>### Brief Issue Summary

I'm using the cmake.ctest.testSuiteDelimiter setting to view my gtests in the test explorer as a tree. When I run any of the tests, after expanding one of the tree elements, it will revert to the closed state. I am able to keep the tree open if I reload the window with the tree expanded, but then when I run a test after collapsing the tree it reverts to being expanded. It's almost like the tree has an initial state of what is expanded and running a test reverts to that state.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.106.2",
  "cmtVersion": "1.21.36",
  "configurations": [
    {
      "folder": "/home/thomas/projects/git/wavefront",
      "cmakeVersion": "3.31.6",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: wavefront 
[proc] Executing command: /usr/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ --no-warn-unused-cli -S /home/thomas/projects/git/wavefront -B /home/thomas/projects/git/wavefront/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Appending code coverage compiler flags: -g --coverage
[cmake] -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
[cmake] -- Doxygen not found, not building docs
[cmake] -- GLM: Version 1.0.2
[cmake] -- GLM: Build with C++ features auto detection
[cmake] Generate test parser_tests
[cmake] Generate test split_string_space_tests
[cmake] Generate test split_string_tests
[cmake] Generate test trim_string_tests
[cmake] -- Configuring done (0.4s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: /home/thomas/projects/git/wavefront/build
[cmakefileapi-parser] Read reply folder: /home/thomas/projects/git/wavefront/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-141abae82097a8b1829c.json","cmakeFiles-v1-704e8308b8978291395b.json","codemodel-v2-93708a648829c7d0529c.json","directory-.-Debug-a6d278aab90e0d2a02df.json","directory-_deps.glm-build-Debug-201ada10ea0a1b5f163e.json","directory-_deps.glm-build.glm-Debug-894397eaf2e95b475181.json","directory-_deps.googletest-build-Debug-325181791364522dc3de.json","directory-_deps.googletest-build.googletest-Debug-de7a7819599cf3ddfbd1.json","directory-external-Debug-c957a038f5114282bdaf.json","directory-src-Debug-1ff04ebb6bc18e202804.json","directory-tests-Debug-b01f6abb0ab61427ef3b.json","index-2025-11-27T05-43-07-0683.json","target-Continuous-Debug-7123eaa45a0f21e2e564.json","target-ContinuousBuild-Debug-256a00903484a043ee44.json","target-ContinuousConfigure-Debug-005a0ca7cc6184dda912.json","target-ContinuousCoverage-Debug-621f6e3f87ca0525aeef.json","target-ContinuousMemCheck-Debug-e1082d2f68a1a465d7ca.json","target-ContinuousStart-Debug-0b60030b120c7685d6bf.json","target-ContinuousSubmit-Debug-a8cc13e6f4fe3b319832.json","target-ContinuousTest-Debug-b85fcbb89dc7a1602dd9.json","target-ContinuousUpdate-Debug-3601c895f88a0a9e67b3.json","target-Experimental-Debug-5c36a760f8f38a7a84fc.json","target-ExperimentalBuild-Debug-51859c69abdb99ed2d68.json","target-ExperimentalConfigure-Debug-83d7e96476b21ea9924e.json","target-ExperimentalCoverage-Debug-023db6e34b41d985c6fe.json","target-ExperimentalMemCheck-Debug-46c91d21a9c1d4139604.json","target-ExperimentalStart-Debug-c14cda818c18fcdc0484.json","target-ExperimentalSubmit-Debug-e68e1b0dddd193627a52.json","target-ExperimentalTest-Debug-08aed19ce815ff708c8a.json","target-ExperimentalUpdate-Debug-f7584eb1a7b988cbd0f7.json","target-Nightly-Debug-cb618877903e906e6b48.json","target-NightlyBuild-Debug-666e3e8ad2066a894708.json","target-NightlyConfigure-Debug-0fb6c98cb412a5327776.json","target-NightlyCoverage-Debug-aa31cc5359e7e75942ee.json","target-NightlyMemCheck-Debug-ee0b853b506a175d8432.json","target-NightlyMemoryCheck-Debug-817c465b10017ea3555b.json","target-NightlyStart-Debug-14a6ca831d1cfc8f9120.json","target-NightlySubmit-Debug-6eb18a1b7d8b947412d7.json","target-NightlyTest-Debug-34ada32f0f762706897a.json","target-NightlyUpdate-Debug-4645a5b8528b4a53da13.json","target-Wavefront-Debug-4bc07bd9bcb9f506ab1c.json...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes microsoft/vscode-cmake-tools#4621

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
Copilot AI and others added 3 commits January 29, 2026 20:18
Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
…stale items

Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
…itation

Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test explorer tree expand/collapse reset when running tests Jan 29, 2026
Copilot AI requested a review from hanniavalera January 29, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants