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 452 forks source link

Scan-for-kits duplicates entries for updated kits #2570

Open Nahor opened 2 years ago

Nahor commented 2 years ago

Brief Issue Summary

When a compiler/kit is updated and running "Scan for kits", CMake tools will show both the old and new version of the kit.

Here is an example showing duplicates for MSVC and for MingW kits

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.67.2",
  "cmtVersion": "1.10.5",
  "configurations": [
    {
      "folder": "<removed>,
      "cmakeVersion": "3.23.1",
      "configured": false,
      "generator": "Ninja Multi-Config",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "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

No response

Additional Information

No response

bobbrow commented 2 years ago

Thank you for the feature suggestion. We may not get to this immediately, but would accept a PR from the community if someone can get to this before us.

Zingam commented 2 years ago

Sometimes CMake tools asks to remove missing kits. It's not quite clear when this happens. Is there an action to "Clean up" the kits? If no maybe adding such an action could be part of the solution?

bobbrow commented 2 years ago

We ask to remove missing kits when we detect that the compiler binaries no longer exist.

We don't currently have an action to clean up the Kits. The workaround is to run the 'Edit User-local CMake Kits" command, replace the file contents with [] and then scan for kits again. This issue is asking for us to detect the duplicates when scanning for updates and do the clean up at that point in time instead of adding a new command for it.

Raffaello commented 3 days ago

when click on 'scan for kits':

it would be enough to scan from an empty result set and replace whatever is the current. Or in other words, just do a 'clean all' current kits and then scan for available kits.

one or the other should suffice to have consistent results. as otherwise the cpp-cmake tools looks broken when there is a compiler update.

Amy-Li03 commented 3 days ago

Hi @Raffaello , thanks for sharing your thoughts here! Our development team will investigate this issue later and any progress will update here.