Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml-language-server fails for yaml version #711

Closed
1 of 4 tasks
mosheavni opened this issue May 14, 2022 · 0 comments · Fixed by #712
Closed
1 of 4 tasks

yaml-language-server fails for yaml version #711

mosheavni opened this issue May 14, 2022 · 0 comments · Fixed by #712
Labels

Comments

@mosheavni
Copy link

mosheavni commented May 14, 2022

Describe the bug

I'm using nvim LSP to run yaml-language-server with schema store.
When the server starts, with minimal configuration, I see this error:

[DEBUG][2022-05-14 14:30:22] .../vim/lsp/rpc.lua:454	"rpc.receive"	{
  jsonrpc = "2.0",
  method = "telemetry/event",
  params = {
    name = "yaml.validation.error",
    properties = "Error: Expected '1.1', '1.2' or null as first argument, but found: undefined\n    at Document.setSchema (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/doc/Document.js:273:23)\n    at new Document (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/doc/Document.js:53:14)\n    at Object.composeDoc (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/compose-doc.js:10:17)\n    at Composer.next (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/composer.js:149:40)\n    at next (<anonymous>)\n    at Composer.compose (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/composer.js:131:25)\n    at compose.next (<anonymous>)\n    at Function.from (<anonymous>)\n    at Object.parse (/Users/mavni/Repos/yaml-language-server/out/server/src/languageservice/parser/yamlParser07.js:45:28)\n    at YamlDocuments.ensureCache (/Users/mavni/Repos/yaml-language-server/out/server/src/languageservice/parser/yaml-documents.js:224:40)",
    type = "track"
  }
}

Expected Behavior

Schema validation and completion to work

Steps to Reproduce

  1. Download these files:
curl -fLO https://gist.githubusercontent.com/mosheavni/2149542454c7af89b6eac940ee7a56e3/raw/e7fe9aec16da657f64a6264f500ca9cadfbe0198/minimal_init.lua
curl -fLO https://gist.githubusercontent.com/mosheavni/e92e9b2baf96e928f6d46b10dd7d1e0d/raw/b13b78fe64bf788d174dd06246cfafb5481de3c2/pod.yaml
  1. Change the cmd (line 70) in minimal_init.lua to reflect the language server location on your machine

  2. Run nvim (version 0.7 at least):

nvim -nu minimal_init.lua pod.yaml
  1. See the error by reading this file:
$ grep "or null" $HOME/.cache/nvim/lsp.log
    properties = "Error: Expected '1.1', '1.2' or null as first argument, but found: undefined
    at Document.setSchema (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/doc/Document.js:273:23)
    at new Document (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/doc/Document.js:53:14)
    at Object.composeDoc (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/compose-doc.js:10:17)
    at Composer.next (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/composer.js:149:40)
    at next (<anonymous>)
    at Composer.compose (/Users/mavni/Repos/yaml-language-server/node_modules/yaml/dist/compose/composer.js:131:25)
    at compose.next (<anonymous>)
    at Function.from (<anonymous>)
    at Object.parse (/Users/mavni/Repos/yaml-language-server/out/server/src/languageservice/parser/yamlParser07.js:45:28)
    at YamlDocuments.ensureCache (/Users/mavni/Repos/yaml-language-server/out/server/src/languageservice/parser/yaml-documents.js:224:40)",

Settings

settings = {
  yamlVersion = "1.2",
  disableDefaultProperties = true,
  hover = true,
  trace = {
    server = "verbose"
  },
  completion = true,
  format = {
    enable = true
  },
  validate = true,
  schemaStore = {
    enable = true,
    url = "https://www.schemastore.org/api/json/catalog.json"
  },
  schemas = {
    kubernetes = { '*' }
  }
}

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants