redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.1k stars 264 forks source link

Unable to associate schemastore schema with a file path (nvim) #971

Open serpro69 opened 6 months ago

serpro69 commented 6 months ago

Describe the bug

I'm trying to setup liquibase json schema with yaml-language-server using nvim lsp-config for yamlls and I can't seem to get custom filepaths association to work

So I'm trying to set custom file pattern for liquibase json schema, which doesn't seem to be picked up.

These are the settings for the language server that sets up the yamlls via lspconfig:

  settings = {
    yaml = {
      schemaStore = {
        enable = false
      },
      schemas = {
        ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
        ["https://json.schemastore.org/liquibase-3.2.json"] = {
          "/src/main/resources/*/changelog/*",
          "/src/main/resources/*/liquibase/*",
        },
      },
    },
  }

I've also tried setting schema like ["https://json.schemastore.org/liquibase-3.2.json"] = "/src/main/resources/*/liquibase/*" which results in the same behavior.

Despite registering custom file path for the schema, I'm still not getting it picked up at for the associated files.

Note that I explicitly disabled the schemaStore option for a test because that pulls all schemas by default and seems to set some default paths for each of those ? (E.g. when I enable schemaStore option, I get a usable association for files under src/main/resources/db/changelog, which seems to be a default somewhere?)

LSP Info reports the following:

 Press q or <Esc> to close this window. Press <Tab> to view server doc.

 Language client log: /home/sergio/.local/state/nvim/lsp.log
 Detected filetype:   yaml

 1 client(s) attached to this buffer: 

 Client: yamlls (id: 1, bufnr: [7, 3])
   filetypes:       yaml, yaml.docker-compose, yaml.gitlab
   autostart:       true
   root directory:  /home/sergio/Projects/wlcmtech/backend-poc
   cmd:             /home/sergio/.local/share/nvim/mason/bin/yaml-language-server --stdio

 Configured servers list: html, yamlls, tsserver, cssls, lua_ls

Is there anything I'm missing or how can I debug this further?

LspLog reports this:

[WARN][2024-05-23 09:03:57] ...lsp/handlers.lua:135 "The language server yamlls triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"

Expected Behavior

Should be able to associate schema with a file glob

Current Behavior

Unable to associate schema with a file glob

Steps to Reproduce

1. 2.

Environment

agorgl commented 6 months ago

Same here