microsoft / microsoft/vscode-cmake-tools

Non-existent VS kits aren't removed

Open
#2,008 9 comments 4 reactions 0 assignees View on GitHub
enhancement Feature: kits
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### 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

- **Operating System**: Windows
- **CMake Version**: 3.20.5
- **VSCode Version**: 1.58.2
- **CMake Tools Extension Version**: 1.7.3
- **Compiler/Toolchain**: Visual C++ 2019 Preview

### Other Notes/Information

Contributor guide

Open the contributing guide

Research direction

Start by tracing the kit scan that loads cmake-tools-kits.json and compare the discovered kits with the cached entries reported in the issue log. Reproduce the uninstall-and-rescan sequence, then verify that kits whose Visual Studio installation no longer exists are removed while valid kits remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.