SchemaStore.nvim icon indicating copy to clipboard operation
SchemaStore.nvim copied to clipboard

support yaml

Open ZenLian opened this issue 3 years ago • 2 comments

I'm using .clang-format file, schemas provided by yamlls, and I have to add schemas manually.

Is it possible to support yaml?

Thans a lot!

ZenLian avatar May 28 '22 09:05 ZenLian

Have you seen #3?

b0o avatar May 28 '22 17:05 b0o

🤦‍♂️Sorry didn't search before issue!

It seems yaml.schemaStore.enable just provide the ability for client to ask for a schema list from yamlls. Then client can select one from the list, and set yaml.schemas accordingly. The implementation at client side do need quite a few code, maybe another plugin.

For me, I just want some schemas. I've tried the example code you mentioned in #3, but it didn't work for me. The format of yaml.schemas is different from json.schemas. I did some tweak and it works:

local json_schemas = require('schemastore').json.schemas {}
local yaml_schemas = {}
vim.tbl_map(function(schema)
  yaml_schemas[schema.url] = schema.fileMatch
end, json_schemas)

require('lspconfig').yamlls.setup {
  settings = {
    yaml = {
      schemas = yaml_schemas,
    },
  },
}

It will be convenient if this plugin could provide a builtin support, something like require('schemastore').yaml.schemas.

❤️Thanks.

ZenLian avatar May 28 '22 19:05 ZenLian