neoclide / coc-yaml

Yaml language server extension for coc.nvim
MIT License
248 stars 23 forks source link

switch schema for kubernetes #73

Open manlme opened 1 year ago

manlme commented 1 year ago

I tried to switch the version of kubernetes schema with both url and local file as below in yaml.schemas. it's always report the error and the completion is not working well. when using keyword kubernete. but the schema version for kubernete from dist/languageserver.js is too old. where did this file generated and how?

{
  "yaml.enable":true,
  "yaml.schemas":{
    "file:///Users/xxx/workspace/kubernetes-json-schema/v1.22.5-standalone-strict/all.json":"abc.yaml"
  }
}

the error

  Matches multiple schemas when only one must validate. (yaml-schema: file:///
  Users/xxx/workspace/kubernetes-json-schema/v1.22.5-standalone-strict/all.
  json)

CocInfo

## versions

vim version: NVIM v0.8.0
node version: v19.0.1
coc.nvim version: 0.0.82-55f0f9e 2022-12-04 04:50:13 +0800
coc.nvim directory: /Users/manfred/.cache/vimfiles/repos/github.com/neoclide/coc.nvim
term: iTerm.app
platform: darwin
adamors commented 1 year ago

Seems this issue is coming from the YAML language server see someone else trying to fix it there: https://github.com/redhat-developer/yaml-language-server/pull/841

See also https://github.com/redhat-developer/yaml-language-server/issues/312 etc.

One workaround would be to edit .config/coc/extensions/node_modules/coc-yaml/dist/languageserver.jsand find KUBERNETES_SCHEMA_URL and change the URL. It's hardcoded to https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.20.5-standalone-strict/all.json

Jeansen commented 1 year ago

Why is it hard-coded? It would be fare more flexible to set this e.g. by configuration or environment variables. 1.20.5 is mildly spoken: old.

chemzqm commented 1 year ago

Need upgrade for the language server.