yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

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

Open serpro69 opened this issue 1 year ago • 1 comments

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

Environment

  • [ ] Windows
  • [ ] Mac
  • [x] Linux
  • [ ] other (please specify)

serpro69 avatar May 23 '24 07:05 serpro69

Same here

agorgl avatar May 29 '24 14:05 agorgl