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

CMakeUserPresets.json - not parsed anymore in v1.19.46 #4011

Closed
dornbirndevelops opened this issue Aug 27, 2024 · 3 comments · Fixed by #4008
Closed

CMakeUserPresets.json - not parsed anymore in v1.19.46 #4011

dornbirndevelops opened this issue Aug 27, 2024 · 3 comments · Fixed by #4008
Labels
bug a bug in the product regression used to work and no longer does. Regressions are typically high priority

Comments

@dornbirndevelops
Copy link

Brief Issue Summary

A completely valid CMakeUserPresets.json cannot be parsed with the currently latest pre-release.

Consider the following CMake presets configuration for the steps below:

{
    "version": 4,
    "configurePresets": [
        {
            "name": "default",
            "hidden": false,
            "description": "Default configuration",
            "generator": "Ninja",
            "binaryDir": "${sourceDir}/build",
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": "Release",
                "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
                "CMAKE_INSTALL_PREFIX": "${sourceDir}/install"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "default",
            "hidden": false,
            "description": "Default build",
            "configurePreset": "default",
            "targets": [
                "all"
            ]
        }
    ]
}

Create a CMakePresets.json file with the content from before.
Run the CMake: Select Configure Preset command.
Observation: Configure Preset from file is shown as expected

Now, rename the CMakePresets.json file to a CMakeUserPresets.json file.
Run the CMake: Select Configure Preset command.
Observation: Configure Preset from file is not shown anymore.
Additionally, the editor highlights an error in line 1 "Could not find configure preset 'default' in preset 'default'".

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.92.2",
  "cmtVersion": "1.19.46",
  "configurations": [
    {
      "folder": "/workspaces/my_ide",
      "cmakeVersion": "3.30.2",
      "configured": false,
      "generator": "",
      "usesPresets": true,
      "compilers": {}
    },
    {
      "folder": "/workspaces/my_ide/repos/ccc_demo_lib",
      "cmakeVersion": "3.30.2",
      "configured": false,
      "generator": "",
      "usesPresets": true,
      "compilers": {}
    },
    {
      "folder": "/home/user/.conan",
      "cmakeVersion": "3.30.2",
      "configured": false,
      "generator": "",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "always",
      "configureOnOpen": false
    },
    {
      "communicationMode": "automatic",
      "useCMakePresets": "always",
      "configureOnOpen": false
    },
    {
      "communicationMode": "automatic",
      "useCMakePresets": "always",
      "configureOnOpen": false
    }
  ]
}

Debug Log

[proc] Executing command: /usr/local/bin/cmake --version
[proc] Executing command: /usr/local/bin/cmake -E capabilities
[main] Safe constructing new CMakeProject instance
[variant] Constructing VariantManager
[main] Constructing new CMakeProject instance
[main] Starting CMake Tools second-phase init
[expand] expanded ${workspaceFolder}
[kit] Not reading non-existent kits file: /home/user/.local/share/CMakeTools/cmake-tools-kits.json
[kit] Not reading non-existent kits file: /workspaces/my_ide/.vscode/cmake-kits.json
[main] CMakeProject instance initialization complete.
[main] Safe constructing new CMakeProject instance
[variant] Constructing VariantManager
[main] Constructing new CMakeProject instance
[main] Starting CMake Tools second-phase init
[expand] expanded ${workspaceFolder}
[kit] Not reading non-existent kits file: /home/user/.local/share/CMakeTools/cmake-tools-kits.json
[kit] Not reading non-existent kits file: /workspaces/my_ide/repos/ccc_demo_lib/.vscode/cmake-kits.json
[presetController] Reading presets file /workspaces/my_ide/repos/ccc_demo_lib/CMakeUserPresets.json
[presetController] Reading and validating the presets "file /workspaces/my_ide/repos/ccc_demo_lib/CMakeUserPresets.json"
[presetController] Successfully validated /workspaces/my_ide/repos/ccc_demo_lib/CMakeUserPresets.json against presets schema
[presetController] Reading presets file /workspaces/my_ide/repos/ccc_demo_lib/build/x86_64-gcc-debug/generators/CMakePresets.json
[presetController] Reading and validating the presets "file /workspaces/my_ide/repos/ccc_demo_lib/build/x86_64-gcc-debug/generators/CMakePresets.json"
[presetController] Successfully validated /workspaces/my_ide/repos/ccc_demo_lib/build/x86_64-gcc-debug/generators/CMakePresets.json against presets schema
[presetController] Expanding presets file /workspaces/my_ide/repos/ccc_demo_lib/CMakeUserPresets.json
[proc] Executing command: uname -s
[preset] Could not find configure preset with name x86_64-gcc-debug
[preset] Could not find configure preset with name x86_64-gcc-debug
[presetController] Expansion errors found in the presets file.
[main] CMakeProject instance initialization complete.
[main] Safe constructing new CMakeProject instance
[variant] Constructing VariantManager
[main] Constructing new CMakeProject instance
[main] Starting CMake Tools second-phase init
[expand] expanded ${workspaceFolder}
[kit] Not reading non-existent kits file: /home/user/.local/share/CMakeTools/cmake-tools-kits.json
[kit] Not reading non-existent kits file: /home/user/.conan/.vscode/cmake-kits.json
[main] CMakeProject instance initialization complete.
[extension] Attempting to use cache to configure workspace file:///workspaces/my_ide/repos/ccc_demo_lib
[main] Starting new CMake driver
[main] Starting CMake driver
[cmakefileapi-driver] Creating instance of CMakeFileApiDriver
[driver] Initializing base driver using preset
[main] Unable to configure with existing cache
[extension] [4027] cmake.selectConfigurePreset started
[presetController] Start selection of configure presets. Found 0 presets.
[presetController] Opening configure preset selection QuickPick
[presetController] User cancelled configure preset selection
[extension] [4027] cmake.selectConfigurePreset finished (returned false)

Additional Information

BEFORE: content of CMakeUserPresets.json gets recognized and parsed in v1.18.44 when reloading the window.

image


AFTER: content of CMakeUserPresets.json is not recognized and therefore not parsed in v1.19.46 when reloading the window.

image

@gcampbell-msft
Copy link
Collaborator

@dornbirndevelops Thanks for the issue! We will have this fixed shortly, as we are in the process of releasing our 1.19 official version in the coming week or so. It will get fixed hopefully in the next couple days in pre-release, and then the official release behind it, if everything goes to plan 👍

Thanks for helping us by using pre-release!

@gcampbell-msft gcampbell-msft added regression used to work and no longer does. Regressions are typically high priority bug a bug in the product and removed triage labels Aug 27, 2024
@github-project-automation github-project-automation bot moved this from Blocked to Completed in CMake Tools Aug 27, 2024
@v-frankwang
Copy link
Collaborator

We verified this issue on CMake Tools: v1.19.47 (pre-release) and it has been fixed:
image

@dornbirndevelops
Copy link
Author

dornbirndevelops commented Aug 28, 2024

Thank you very much @gcampbell-msft !
I verified the current state of main, including the changes from #4008.
They also fixed my original problems in #3974.
Looking forward to the next extension release 🎉

FTR: cmake.configureOnEdit does not have to be set to true.

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 regression used to work and no longer does. Regressions are typically high priority
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

3 participants