-
Notifications
You must be signed in to change notification settings - Fork 461
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
CMakePresets.json should allow JSON comments #2104
Comments
Is that new? Because we just addressed an issue where someone said cmake doesn't support JSON 5. See #2035 |
I'm using cmake 3.20. By trying out, I observed that cmake supports comments in CMakePrefixs.json (i.e. by using "cmake --prefix ..."). [Remark: The cmake Extension is just great! Thanks a lot for your work on the extension!!!] |
@xisui-MSFT When you fixed #2035, what were your observations? |
The extension should force presets files to use json format (as opposed to jsonc) whenever a presets file is opened or activated, and you even shouldn't be able to set it to jsonc manually... But I'm wondering if this is caused by a conflict with @tilman22 's settings or another extension. |
I don't think it's settings. He is reporting that passing in a preset on the command line works when the CMakePresets file has comments in it. Do you see the same or different result? |
Ah sorry I misunderstood. That's a good question. We should ask kitware as it's explicitly disallowed in the doc: https://cmake.org/cmake/help/latest/release/3.19.html#id6. |
I can confirm that comments work with the presets file in 3.20.2 and 3.21.2. Seems like a bug on Kitware. |
I opened this bug for them: https://gitlab.kitware.com/cmake/cmake/-/issues/22602 |
cmake allows the CMakePresets.json file to contain JSON-comments.
But the cmake-extension complains if there are comments:
[presetController] Failed to parse CMakePresets.json:
SyntaxError: Unexpected token / in JSON at position 461
at JSON.parse ()
at PresetsController.parsePresetsFile (/home/soti/.vscode-server/extensions/ms-vscode.cmake-tools-1.8.0/dist/main.js:57650:32)
at PresetsController.resetPresetsFile (/home/soti/.vscode-server/extensions/ms-vscode.cmake-tools-1.8.0/dist/main.js:57036:38)
at async PresetsController.reapplyPresets (/home/soti/.vscode-server/extensions/ms-vscode.cmake-tools-1.8.0/dist/main.js:57051:9)
at async FSWatcher. (/home/soti/.vscode-server/extensions/ms-vscode.cmake-tools-1.8.0/dist/main.js:56993:17)
[preset] Could not find configure preset with name
The text was updated successfully, but these errors were encountered: