Skip to content
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

Extension can't find CMakePresets json schema #3651

Closed
nikoprotic opened this issue Mar 13, 2024 · 8 comments
Closed

Extension can't find CMakePresets json schema #3651

nikoprotic opened this issue Mar 13, 2024 · 8 comments
Assignees
Labels
bug a bug in the product Feature: presets
Milestone

Comments

@nikoprotic
Copy link

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 nikoprotic changed the title Extension can't find CMakePresetsjson schema Extension can't find CMakePresets json schema Mar 13, 2024
@github-project-automation github-project-automation bot moved this to Triage Needed in CMake Tools Mar 13, 2024
@gcampbell-msft
Copy link
Collaborator

@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 gcampbell-msft added bug a bug in the product Feature: presets and removed triage labels Mar 15, 2024
@gcampbell-msft gcampbell-msft added this to the On Deck milestone Mar 15, 2024
@gcampbell-msft gcampbell-msft moved this from Triage Needed to Pending Prioritization in CMake Tools Mar 15, 2024
@nikoprotic
Copy link
Author

nikoprotic commented Mar 18, 2024

@gcampbell-msft,

Sorry for the delayed response. I see this pretty consistently. Restarting/updating VS Code does not remedy it.

@gcampbell-msft
Copy link
Collaborator

@nikoprotic No worries. We'll investigate this as soon as we have capacity.

@AkbarTheGreat
Copy link

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
    }
  ]
}

@v-ericawu
Copy link
Collaborator

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:

  1. Create a folder named ‘Demo’ and open it with VS Code.
  2. 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
image

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
}]
image

@gcampbell-msft gcampbell-msft modified the milestones: On Deck, 1.18 Apr 23, 2024
@gcampbell-msft gcampbell-msft moved this from Pending Prioritization to Ready to be Assigned in CMake Tools Apr 23, 2024
@gcampbell-msft
Copy link
Collaborator

@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.

@gcampbell-msft
Copy link
Collaborator

Currently investigating whether we should add onFileSystem:cmake-tools-schema activation event, or wait for this bug: microsoft/vscode#211116, to be solved (or at least answered).

@v-ericawu
Copy link
Collaborator

@gcampbell-msft Thanks for your investigation, using workaround as you mentioned above will solve the issue:
workaround

@gcampbell-msft gcampbell-msft self-assigned this Apr 25, 2024
@gcampbell-msft gcampbell-msft moved this from Ready to be Assigned to Completed in CMake Tools Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product Feature: presets
Projects
Status: Completed
Development

No branches or pull requests

4 participants