-
Notifications
You must be signed in to change notification settings - Fork 449
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
Unable to parse CMakePresets.json file generated by VS #2396
Comments
Thanks for reporting this. We should be able to use |
Merged
This should be fixed in 1.10.2 (pre-release). |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Brief Issue Summary
I tried to open a CMake project generated by VS (32119.88.main) in VS Code (1.64.2, with CMake Tools 1.9.2 installed), and got the following error:
[presetController] Failed to parse CMakePresets.json:
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse ()
at PresetsController.parsePresetsFile (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:60445:36)
at PresetsController.resetPresetsFile (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:59782:38)
at PresetsController.reapplyPresets (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:59797:9)
at watchPresetsChange (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:59699:13)
at Function.init (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:59727:9)
at Function.init (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55479:35)
at CMakeToolsFolderController._addFolder (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55727:22)
at CMakeToolsFolderController.loadAllCurrent (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55679:17)
at ExtensionManager._init (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:54050:13)
at Function.create (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:54102:9)
at setup (c:\Users\xisui.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55194:32)
Repro steps:
This might be an encoding issue. The file encoding of CMakePresets.json generated by VS is UTF-8 with BOM. Also, saving the file as UTF-8 in VS Code seems to work.
UTF-8 with bom DOES work using CMake (like
cmake --preset presetName
). So I think it makes sense to fix this issue in CMake tools.The text was updated successfully, but these errors were encountered: