1

i try to get kubernetes auto completion going in nvim. I am using neovim nightly (0.5.) with 'neovim-lspconfig' and 'nvim-lua/completion-nvim'. I installed the yaml-language-sever and it is working fine (i know it is working because it is showing errors inside yaml files in nvim).

I am fairly new to lua and nvim-lsp, it might just be a syntax error. I try to configure the server with this lua code:

local lspconfig = require'lspconfig'
lspconfig.yamlls.setup{
    on_attach = require'completion'.on_attach,
    settings = {
        yaml.schemas = { kubernetes = "globPattern" },
    }
}

I tried thousand different ways to write it but i always get Errors like:

Error loading lua [string ":lua"]:5: '}' expected (to close '{' at line 4) near '='

The documentation just says to add server configs via the settings key. But i am not quite sure how.

Anybody got this going? Thanks a lot.

Y-Peter
  • 47
  • 1
  • 6

1 Answers1

2

You should change it to

lspconfig.yamlls.setup{
    settings = {
        yaml = {
           schemas = { kubernetes = "globPattern" },
      }
}
sakis4440
  • 36
  • 1
  • Thanks for the response. At least the Error is gone with your solution. But still no autocompletion in the yaml files. Is this working for you? – Y-Peter Apr 06 '21 at 06:07
  • 1
    Check if the server is up (:LspInfo), Set the globPattern to something meaningful for you, like *.yaml – sakis4440 Apr 08 '21 at 15:40
  • i got the pattern "/*.yaml". LSP is working since it gives me now error messages in yaml files now. Just no autocompletion :/ – Y-Peter Apr 09 '21 at 16:25
  • nvm. It works after updating all plugins. Thx! – Y-Peter Apr 12 '21 at 10:21