vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Extension can't find CMakePresets json schema
Brief Issue Summary
When opening CMakePresets.json in VSCode, I receive this warning at the top of the file:
Problems loading reference 'schemaservice://combinedschema/cmake-tools-schema:/schemas/CMakePresets-v6-schema.json': Unable to load schema from 'schemaservice://combinedschema/cmake-tools-schema:/schemas/CMakePresets-v6-schema.json': cannot open schemaservice://combinedschema/cmake-tools-schema%3A/schemas/CMakePresets-v6-schema.json. Detail: Unable to resolve resource schemaservice://combinedschema/cmake-tools-schema%3A/schemas/CMakePresets-v6-schema.json.(768)
Additionally I get no language support for the file.
CMake Tools Diagnostics
{
"os": "darwin",
"vscodeVersion": "1.87.1",
"cmtVersion": "1.17.17",
"configurations": [
{
"folder": "/path/to/my/workspace",
"cmakeVersion": "3.28.3",
"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": "auto",
"configureOnOpen": true
}
]
}
Debug Log
No response
Additional Information
No response
@nikoprotic Thanks for posting the issue. I also occasionally see this, though it has always been very flaky for me.
Do you find that this is a flaky issue? Or is this a longstanding issue that does not go away over time or with restarting of VS Code?
@gcampbell-msft,
Sorry for the delayed response. I see this pretty consistently. Restarting/updating VS Code does not remedy it.
@nikoprotic No worries. We'll investigate this as soon as we have capacity.
I'm seeing this as well, just in case I can help at all, my cmake diagnostics (somewhat redacted, I tried to add context while removing PII:
{
"os": "win32",
"vscodeVersion": "1.88.0",
"cmtVersion": "1.17.17",
"configurations": [
{
"folder": "drive:\\path\\in\\windows\\style\\to\\workspace",
"cmakeVersion": "3.28.0",
"configured": true,
"generator": "Visual Studio 17 2022",
"usesPresets": true,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 18,
"executablesCount": 11,
"librariesCount": 4,
"targets": [
{
"name": "ALL_BUILD",
"type": "UTILITY"
},
{
"name": "TestName1",
"type": "EXECUTABLE"
},
...
{
"name": "TestName9",
"type": "EXECUTABLE"
},
{
"name": "ZERO_CHECK",
"type": "UTILITY"
},
{
"name": "clangformat",
"type": "UTILITY"
},
{
"name": "ProjectTarget",
"type": "EXECUTABLE"
},
{
"name": "SecondaryBinary",
"type": "EXECUTABLE"
},
{
"name": "IntermediateLibrary1",
"type": "OBJECT_LIBRARY"
},
...
{
"name": "IntermediateLibrary4",
"type": "OBJECT_LIBRARY"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
Tested on CMake Tools extension v1.18.20(pre-release), this issue also repro: ‘Unable to load schema from 'cmake-tools-schema:/schemas/CMakePresets-v8-schema.json'’ warning appear in CMakePresets.json file
ENV: VS Code: 1.88.0 CMake: v0.0.17 CMake Tools: v1.18.20(pre-release)
Repro Steps:
- Create a folder named ‘Demo’ and open it with VS Code.
- Add ‘CMakePresets.json’ file and Type {} in it.
More Info: Win/Linux/Mac version all reproduce the issue
Expected Result: No ‘Unable to load schema from 'cmake-tools-schema:/schemas/CMakePresets-v8-schema.json' warnings appears or a warning similar to that in VS appears
Actual Result:
[{
"resource": "/c:/Users/v-ericawu/Desktop/Demo/CMakePresets.json",
"owner": "_generated_diagnostic_collection_name_1",
"code": "768",
"severity": 4,
"message": "Unable to load schema from 'cmake-tools-schema:/schemas/CMakePresets-v8-schema.json': cannot open cmake-tools-schema:/schemas/CMakePresets-v8-schema.json. Detail: Unable to resolve resource cmake-tools-schema:/schemas/CMakePresets-v8-schema.json.",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}]
@v-ericawu I think I know what the issue is. If you close the CMakePresets.json file, reload VS Code, and then do something to ensure that the extension activates (i.e. run the cmake configure command), then when you open the CMakePresets.json file, it will work.
I think it's an issue of when the extension activates and when it calls provideTextDocumentContent from the SchemaProvider.
Currently investigating whether we should add onFileSystem:cmake-tools-schema activation event, or wait for this bug: https://github.com/microsoft/vscode/issues/211116, to be solved (or at least answered).
@gcampbell-msft Thanks for your investigation, using workaround as you mentioned above will solve the issue: