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

Documentation note about lspconfig/util for volume syncing

Open yzguy opened this issue 3 years ago • 0 comments

Got this error when adding in the yamlls configuration and then starting neovim

Error detected while processing /Users/example/.dotfiles/nvim/init.vim:
line   94:
E5108: Error executing lua [string ":lua"]:28: attempt to index global 'util' (a nil value)

Looking at ALT-F4-LLC/dotfiles it seems the following line needs defined, and after adding it, it allows it to work.

util = require 'lspconfig/util'

Full configuration looks like

lua <<EOF
util = require 'lspconfig/util'

on_new_config = function(new_config, new_root_dir)
  new_config.cmd = require'lspcontainers'.command(server, { root_dir = new_root_dir })
end

-- YAML
require'lspconfig'.yamlls.setup {
  before_init = function(params)
    params.processId = vim.NIL
  end,
  cmd = require'lspcontainers'.command('yamlls'),
  root_dir = util.root_pattern(".git", vim.fn.getcwd()),
}
EOF

Not sure if it would worthwhile to document this, or that's just a standard thing.

yzguy avatar Oct 08 '21 18:10 yzguy