microsoft / vscode-cmake-tools

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

Duplicate build tasks in quick pick list #4064

Closed jurf closed 2 months ago

jurf commented 2 months ago

Brief Issue Summary

With cmake.buildTask active and a build task configured, CMake also shows the template build tasks.

quick pick list screenshot

Only one of the tasks in the screenshot is configured manually, but two other build tasks are present. This behaviour did not happen a few weeks back.

Possibly duplicate of the closed and locked #2936.

CMake Tools Diagnostics

Some details omitted as this is a work machine.

{
  "os": "win32",
  "vscodeVersion": "1.93.1",
  "cmtVersion": "1.19.51",
  "configurations": [
    {
      "folder": "c:\\projects\\cmake_project",
      "cmakeVersion": "3.30.2",
      "configured": true,
      "generator": "Unix Makefiles",
      "usesPresets": true,
      "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

Relevant task in tasks.json:

        {
            "type": "cmake",
            "label": "CMake: build (manually configured in tasks.json)",
            "command": "build",
            "preset": "${command:cmake.activeBuildPresetName}",
            "group": {
                "kind": "build",
                "isDefault": false
            },
            "problemMatcher": "$gcc",
            "presentation": {
                "revealProblems": "onProblem"
            },
            "detail": "CMake template build task"
        }
v-frankwang commented 2 months ago

@jurf I'm very sorry that we can't reproduce the problem you mentioned, can you provide us with the detailed procedure? So that we can quickly go and investigate the issue. Here are my results, can you give some suggestions? image

jurf commented 2 months ago

Hi, thanks for the reply.

Perhaps there is a misunderstanding. IIRC before, when one manually defined the task, it overrode the automatically generated build tasks. Now one has to pick one in the list, with no option to select a default, adding a step to every build. First there was only the manually-defined task in the list, now I see four, two of which are duplicates. That is the bug I am reporting.

Why the task with the name build is not present in your project, I have no idea. In my project it behaves the same as CMake: build.

If there is any more information I can provide, I would gladly be of assistance.

v-frankwang commented 2 months ago

@gcampbell-msft I tried to reproduce the issue on the previous version: v1.17.17 still got the same result as https://github.com/microsoft/vscode-cmake-tools/issues/4064#issuecomment-2350933655. Can you give me some advice?

image

jurf commented 2 months ago

Could you send me the test project that you used? I would be curious if I get the same behaviour.

v-frankwang commented 2 months ago

@jurf Here are the items I use, I hope you can tell me if anything is incorrect and I look forward to hearing from you! 4064.zip

gcampbell-msft commented 2 months ago

I just tested and even on v1.16.32, we see this: image

Again, this is because the default tasks are provided to VS Code, and then VS Code separately parses the tasks.json. Closing as by design.