microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

Non-existent VS kits aren't removed #2008

Open sam20908 opened 3 years ago

sam20908 commented 3 years ago

Brief Issue Summary

When VS no longer exists on the system (i.e. uninstalling them), I expected the cached kits to be removed the next time I scan for kits, but that's not the case.

Expected:

  1. Remove VS (I uninstalled it, not aware of other ways to make it "invisible").
  2. Scan kits and check the kits again, the previous VS toolkits will still be there.

CMake Tools Log

[variant] Loaded new set of variants
[kit] Successfully loaded 13 kits from C:\Users\Sam Huang\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: mpp 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DMPP_BUILD_TESTS=TRUE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-Hc:/Users/Sam Huang/Projects/mpp" "-Bc:/Users/Sam Huang/Projects/mpp/build" -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: C:/Users/Sam Huang/Projects/mpp/build
[proc] Executing command: C:\msys64\mingw64\bin\gcc.exe -v
[proc] Executing command: C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc-10.3.0.exe -v
[proc] Executing command: C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -v
[kit] Found Kit: GCC 10.3.0 x86_64-w64-mingw32
[kit] Found Kit: GCC 10.3.0 x86_64-w64-mingw32
[kit] Found Kit: GCC 10.3.0 x86_64-w64-mingw32
[kit] Successfully loaded 13 kits from C:\Users\Sam Huang\AppData\Local\CMakeTools\cmake-tools-kits.json

Developer Tools Log

workbench.desktop.main.js:sourcemap:62 [Extension Host] (node:12596) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `Code --trace-deprecation ...` to show where the warning was created)
m @ workbench.desktop.main.js:sourcemap:62
workbench.desktop.main.js:sourcemap:2844 [twxs.cmake]: Cannot register 'cmake.cmakePath'. This property is already registered.
_logMessageInConsole @ workbench.desktop.main.js:sourcemap:2844
marketplace.visualstudio.com/_apis/public/gallery/extensionquery:1 Failed to load resource: net::ERR_CONNECTION_RESET
workbench.desktop.main.js:sourcemap:62 [Extension Host] activating extension
workbench.desktop.main.js:sourcemap:62 [Extension Host] starting language server
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:30.255Z [debug] [main] Safe constructing new CMakeTools instance
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:30.256Z [debug] [variant] Constructing VariantManager
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:30.258Z [debug] [main] Constructing new CMakeTools instance
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:30.258Z [debug] [main] Starting CMakeTools second-phase init
workbench.desktop.main.js:sourcemap:62 [Extension Host] strict mode: missing type "object" for keyword "required" at "#/patternProperties/%5E%5Cw%2B%24/properties/choices/patternProperties/%5E%5Cw%2B%24" (strictTypes)
m @ workbench.desktop.main.js:sourcemap:62
workbench.desktop.main.js:sourcemap:62 [Extension Host] strict mode: missing type "object" for keyword "properties" at "#/patternProperties/%5E%5Cw%2B%24/properties/choices/patternProperties/%5E%5Cw%2B%24" (strictTypes)
m @ workbench.desktop.main.js:sourcemap:62
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.023Z [info] [variant] Loaded new set of variants
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.024Z [debug] [main] CMakeTools instance initialization complete.
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.029Z [debug] [kit] Reading kits file C:\Users\Sam Huang\AppData\Local\CMakeTools\cmake-tools-kits.json
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.146Z [info] [kit] Successfully loaded 13 kits from C:\Users\Sam Huang\AppData\Local\CMakeTools\cmake-tools-kits.json
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.166Z [debug] [kit] Not reading non-existent kits file: c:\Users\Sam Huang\Projects\mpp\.vscode\cmake-kits.json
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.192Z [debug] [main] Injecting new Kit into CMake driver
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.240Z [debug] [extension] Configuring workspace on open file:///c%3A/Users/Sam%20Huang/Projects/mpp
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.241Z [info] [main] Configuring folder: mpp 
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:31.243Z [debug] [main] Saving open files before configure/build
workbench.desktop.main.js:sourcemap:62 [Extension Host] updateCustomBrowseConfiguration
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.315Z [debug] [main] Starting new CMake driver
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.316Z [debug] [main] Starting CMake driver
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.316Z [debug] [main] Using generator from user configuration: Ninja
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.317Z [debug] [cmakefileapi-driver] Creating instance of CMakeFileApiDriver
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.319Z [debug] [driver] Initializating base driver using kit
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.320Z [debug] [driver] CMakeDriver Kit set to __unspec__
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.326Z [debug] [driver] Run _refreshExpansions
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.327Z [debug] [driver] Run _refreshExpansions cb
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.498Z [debug] [cache] Reading CMake cache file c:/Users/Sam Huang/Projects/mpp/build/CMakeCache.txt
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.601Z [debug] [cache] Parsing CMake cache string
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.633Z [debug] [cache] Reading CMake cache file c:/Users/Sam Huang/Projects/mpp/build/CMakeCache.txt
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.642Z [debug] [cache] Parsing CMake cache string
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.670Z [debug] [cmakefileapi-parser] Read reply folder: c:\Users\Sam Huang\Projects\mpp\build\.cmake\api\v1\reply
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.695Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-b0f993b30340d9846b0c.json","codemodel-v2-4dcaf3e51af1c20e1a75.json","index-2021-07-22T21-42-26-0498.json","target-algos_test-Debug-7a971885e6a50ae4045a.json","target-ariths_test-Debug-faec69834ae1502d5525.json","target-assign_test-Debug-9bbc15e8443ff96bbdb0.json","target-customize_test-Debug-cc0026e4c0c252a304f3.json","target-init_test-Debug-c962eabe358effcd4482.json","target-iter_test-Debug-6aabd778e94d5321bf66.json","target-mem_fns_test-Debug-9e42d405bd5e6ff39d90.json","target-tests-Debug-dd48eb3353d3f9f57292.json","target-utils_test-Debug-e5e7f4197775b08fa08a.json","toolchains-v1-0b60f7fb1411fae0baf8.json"]
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.750Z [debug] [driver] Setting new variant Debug
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.751Z [debug] [driver] Run _refreshExpansions
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:32.751Z [debug] [driver] Run _refreshExpansions cb
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.182Z [debug] [driver] Run _refreshExpansions
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.182Z [debug] [driver] Run _refreshExpansions cb
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.191Z [debug] [driver] Start configure 
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.193Z [debug] [driver] Runnnig pre-configure checks and steps
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.201Z [debug] [driver] Run _refreshExpansions
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.201Z [debug] [driver] Run _refreshExpansions cb
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.217Z [debug] [cmakefileapi-driver] Configuring using kit
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.217Z [debug] [cmakefileapi-driver] Invoking CMake C:\Program Files\CMake\bin\cmake.EXE with arguments ["--no-warn-unused-cli","-DMPP_BUILD_TESTS=TRUE","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-Hc:/Users/Sam Huang/Projects/mpp","-Bc:/Users/Sam Huang/Projects/mpp/build","-G","Ninja"]
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.227Z [info] [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DMPP_BUILD_TESTS=TRUE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-Hc:/Users/Sam Huang/Projects/mpp" "-Bc:/Users/Sam Huang/Projects/mpp/build" -G Ninja
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.457Z [info] [cmake] Not searching for unused variables given on the command line.
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.632Z [info] [cmake] -- Configuring done
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.743Z [info] [cmake] -- Generating done
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.896Z [info] [cmake] -- Build files have been written to: C:/Users/Sam Huang/Projects/mpp/build
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.903Z [debug] [cmakefileapi-parser] Read reply folder: c:\Users\Sam Huang\Projects\mpp\build\.cmake\api\v1\reply
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:33.907Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-b0f993b30340d9846b0c.json","codemodel-v2-4dcaf3e51af1c20e1a75.json","index-2021-07-22T21-44-33-0894.json","target-algos_test-Debug-7a971885e6a50ae4045a.json","target-ariths_test-Debug-faec69834ae1502d5525.json","target-assign_test-Debug-9bbc15e8443ff96bbdb0.json","target-customize_test-Debug-cc0026e4c0c252a304f3.json","target-init_test-Debug-c962eabe358effcd4482.json","target-iter_test-Debug-6aabd778e94d5321bf66.json","target-mem_fns_test-Debug-9e42d405bd5e6ff39d90.json","target-tests-Debug-dd48eb3353d3f9f57292.json","target-utils_test-Debug-e5e7f4197775b08fa08a.json","toolchains-v1-0b60f7fb1411fae0baf8.json"]
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:34.073Z [debug] [cache] Reading CMake cache file c:/Users/Sam Huang/Projects/mpp/build/CMakeCache.txt
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:34.082Z [debug] [cache] Parsing CMake cache string
workbench.desktop.main.js:sourcemap:62 [Extension Host] updateCustomBrowseConfiguration
workbench.desktop.main.js:sourcemap:62 [Extension Host] provideCustomConfiguration
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:34.534Z [debug] [cache] Reading CMake cache file c:/Users/Sam Huang/Projects/mpp/build/CMakeCache.txt
workbench.desktop.main.js:sourcemap:62 [Extension Host] [CMakeTools] 2021-07-22T21:44:34.536Z [debug] [cache] Parsing CMake cache string
workbench.desktop.main.js:sourcemap:62 [Extension Host] [vscode-icons] v11.5.0 activated!
workbench.desktop.main.js:sourcemap:62 [Extension Host] command:editor.action.addCommentLine

Platform and Versions

Other Notes/Information

bobbrow commented 3 years ago

Thank you for your suggestion. We do prompt to remove Kits that have an explicit compiler path when that path is no longer valid, but we don't store compiler paths in VS Kits, so they don't currently participate in the pruning. It would be good for us to detect when a VS Kit has been uninstalled.

sam20908 commented 2 years ago

Any updates on this? It's been almost a year, and this is starting to get a little annoying, especially with Clang + MSVC image

david-fong commented 2 years ago

Is there a way to manually remove dead entries?

bobbrow commented 2 years ago

Is there a way to manually remove dead entries?

You can remove dead entries by running the CMake: Edit User-Local CMake Kits command. This will open the json file. From there, you can either search out and remove the dead Kits, or just replace the whole file with [] and rescan for Kits.

enjustli commented 1 month ago

when we do [Scan for kits], why not auto clear the cmake-tools-kits.json ? 😋

gcampbell-msft commented 1 month ago

@enjustli While I appreciate the annoyance with stale kits not being removed, we shouldn't just auto clear the cmake-tools-kits.json, because there may be manual entries that have been added that we don't want to remove forcefully, we would instead need to handle the feature request of better handling VS kits being uninstalled.