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

JSON Schema not applied for custom file extension #701

Closed
1 of 4 tasks
demilsson opened this issue Feb 21, 2022 · 2 comments · Fixed by redhat-developer/yaml-language-server#714
Closed
1 of 4 tasks

Comments

@demilsson
Copy link

Describe the bug

We have added the following schema to the JSON schema store:

    {
      "name": "Settings.paf",
      "description": "Qualisys Project Automation Framework settings file",
      "fileMatch": [
          "settings.paf",
          "Settings.paf"
      ],
      "url": "https://raw.githubusercontent.com/qualisys/qualisys-schemas/master/paf-module.schema.json"
    },

However, it appears it won't be applied to our files.

.paf files are associated as yaml files in vscode like so:

    "files.associations": {
        "*.paf": "yaml"
    },

The files are correctly formatted as YAML, but again, without applying the correct schema.
The status-bar icon says "no JSON schema" and when clicking it to see the list, it doesn't include our schema either.

My theories are:

  1. The schema isn't being applied because the file extension isn't a standard YAML extension (I also aren't seeing some other schemas from the schema store that use non-standard extensions in the list of schemas)
  2. The schemas are aggressively cached (the schema was added close to a week ago, vscode has been restarted multiple times, the JSON schema cache has been cleared) I have also tested on another computer which didn't have this extension installed and after configuring it the same way, I got the same result – which makes the cache theory less likely.

Expected Behavior

The schema defined in the schema store should be applied for files named settings.paf (when the paf extension is associated with YAML).

Current Behavior

No schema is applied for files named settings.paf.

Steps to Reproduce

  1. Create file called settings.paf
  2. See that the YAML plugin fails to associate it with any schema.

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
@evidolob
Copy link
Collaborator

The schema store support is implemented in such way that yaml-language-server filter out schema store records, based on fileMatch patterns, it ignore all items which doesn’t have any of *.yaml.

@gorkem Maybe we can improve filtering by checking files.associations preference?

@gorkem
Copy link
Collaborator

gorkem commented Feb 23, 2022

+1 to check the files.associations. I wish vscode had a better API for checking patterns associated with a language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants