redhat-developer / redhat-developer/yaml-language-server

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

Open
#971 1 comment 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported settings with yamlls through nvim-lspconfig, using the custom Liquibase file globs and the LSP log at /home/sergio/.local/state/nvim/lsp.log. Trace schema association from the YAML language-server configuration and verify that the specified files receive the Liquibase schema without relying on schemaStore defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim, typescript, yaml
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.