Skip to content

[Bug] CMakePresets.json "$comment": fields breaks parsing #4452

@BenFrantzDale

Description

@BenFrantzDale

Brief Issue Summary

The CMake docs advise using "$comment": fields for comments (i.e., not .jsonc -- json with comments) yet if I do that, CMake Tools breaks down.

CMake Tools Diagnostics

"os": "linux",
  "vscodeVersion": "1.96.2",
  "cmtVersion": "1.20.53",
  "configurations": [
    {
      "folder": "/path/to/my/project",
      "cmakeVersion": "3.27.0",
      "configured": true,
      "generator": "Ninja Multi-Config",
      "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

[presetController] Reading and validating the presets "file /path/to/my/project/CMakePresets.json"
[presetController] Unsupported presets detected in /path/to/my/project/CMakePresets.json. Support is limited to features defined by version 9.
[presetController]  >> : should NOT have additional properties: $comment
[presetController] Unknown properties and macros can be ignored by using the 'cmake.allowUnsupportedPresetsVersions' setting.

Additional Information

where /path/to/my/project/CMakePresets.json starts with

{
    "$comment": "foo",

Even if I add "cmake.allowUnsupportedPresetsVersions": true, to my .vscode/settings.json it still says the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    Status

    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions