vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Unable to resolve resource cmake-tools-schema:/schemas/CMakePresets-v3-schema.json in trusted workspace

Open 1100101 opened this issue 2 years ago • 3 comments

Brief Issue Summary

I am unable to verify the content of my CMakePresets.json/CMakeUserPresets.json against the JSON schema that comes with the extension, because apparently the extension is not able to open the schema resource:

[{
	"resource": "/d:/CMakePresets.json",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "768",
	"severity": 4,
	"message": "Unable to load schema from 'cmake-tools-schema:/schemas/CMakePresets-v3-schema.json': cannot open cmake-tools-schema:/schemas/CMakePresets-v3-schema.json. Detail: Unable to resolve resource cmake-tools-schema:/schemas/CMakePresets-v3-schema.json.",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 2
}]

This is a with a cleanly installed version of VS Code, with default configuration (no custom settings whatsoever).

When I Open a CMakePresets.json with the extension installed, at first no error is shown because the application is in "Restricted mode" (the workspace hasn't been trusted yet). As soon as I trust the workspace, the schema error appears.

Typing silly values for some of the CMake JSON variables has no effet, the file is not validated against the schema.

CMake Tools Diagnostics

`command 'cmake.logDiagnostics' not found`

Debug Log

No CMake build attempted

Additional Information

Machine

Windows 10 Entersprise, v1909 (18363.2212)

VS Code

Version: 1.67.2 (user setup) Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 Date: 2022-05-17T18:15:52.058Z Electron: 17.4.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Windows_NT x64 10.0.18363

CMake Tools Extension

Name: CMake Tools Id: ms-vscode.cmake-tools Description: Extended CMake support in Visual Studio Code Version: 1.10.5 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools

1100101 avatar Jun 09 '22 09:06 1100101

We've been seeing spurious reports of schemas not being found (I've experienced it before as well, but not consistently for us to be able to debug it yet). #2135 refers to another case of this, but with a different file (cmake-variants.yaml). What's weird in your report is that you say that cmake.logDiagnostics is not found which might point to a corrupted installation of the extension. Perhaps uninstalling and reinstalling it might help with that.

bobbrow avatar Jun 09 '22 16:06 bobbrow

Is it possible that the extension only works correctly if I open a folder (with CMakePresets.json) in VS Code? When I do that, I don't get any errors, and the schema seems to be handled correctly. If I open just the CMakePresets.json, the error shows up.

1100101 avatar Jun 09 '22 20:06 1100101

Yes, the extension does not activate automatically in that case. I'm surprised that VS Code would try to load our schema without loading our extension though. This may be a VS Code issue.

bobbrow avatar Jun 10 '22 00:06 bobbrow