Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ${command:cmake.selectConfigurePreset} in tasks.json pops up error when selecting already active configuration #4239

Open
FredC-LT opened this issue Jan 14, 2025 · 1 comment
Labels
bug a bug in the product Feature: UI
Milestone

Comments

@FredC-LT
Copy link

Brief Issue Summary

Hi,

I have a vscode task that I use to change the current configuration preset:

{
    "label": "set active config",
    "group": "build",
    "command": "${command:cmake.selectConfigurePreset}"
}

I can toggle without issues between configurations Release, Debug. The issue arises when I select the already active configuration, then I get this error:
Cannot substitute command variable 'cmake.selectConfigurePreset' because command did not return a result of type string.

How to reproduce

  1. Run the task, select "X" configuration
  2. Run the task again, select the same "X" configuration

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.95.3",
  "cmtVersion": "1.19.52",
  "configurations": [
    {
      "folder": "/opt/my-project",
      "cmakeVersion": "3.27.0",
      "configured": true,
      "generator": "Unix Makefiles",
      "usesPresets": true,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 34,
    "executablesCount": 3,
    "librariesCount": 3,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

Additional Information

No response

@Yingzi1234
Copy link
Collaborator

Yingzi1234 commented Jan 15, 2025

@FredC-LT Thank you for reporting the problem here! We can reproduce this issue based the above information. We have been changed this issue to bug, please be patient with the results of our investigation and we will notify you of any updates as soon as they are available!
@gcampbell-msft We can reproduce the issue on latest CMake Tools version 1.20.36(pre-release) and change the Label to ‘Bug’ for now, if it is wrong could you please change it to the correct label, the reproduction steps are detailed below. Thanks!

Repro steps:

  1. Open this folder Test3.zip by VSCode
  2. Click F1 to run command "CMake: configure" and choose the "Debug"
  3. Click F1 to run command "Tasks: run task"
  4. Click "set active config" and choose the "Debug"

Actual result:
When the same option is selected repeatedly, an error popup appears in the bottom right corner of the page
Error message:
Cannot substitute command variable 'cmake.selectConfigurePreset' because command did not return a result of type string.

Image

@Yingzi1234 Yingzi1234 added bug a bug in the product and removed triage labels Jan 15, 2025
@gcampbell-msft gcampbell-msft added this to the Backlog milestone Jan 17, 2025
@gcampbell-msft gcampbell-msft moved this from Blocked to Pending Prioritization in CMake Tools Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product Feature: UI
Projects
Status: Pending Prioritization
Development

No branches or pull requests

3 participants