lua-ls.lua 1.1 KB

123456789101112131415161718192021222324252627
  1. -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
  2. local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
  3. local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
  4. require'lspconfig'.sumneko_lua.setup {
  5. cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
  6. on_attach = require'lsp'.common_on_attach,
  7. settings = {
  8. Lua = {
  9. runtime = {
  10. -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
  11. version = 'LuaJIT',
  12. -- Setup your lua path
  13. path = vim.split(package.path, ';')
  14. },
  15. diagnostics = {
  16. -- Get the language server to recognize the `vim` global
  17. globals = {'vim'}
  18. },
  19. workspace = {
  20. -- Make the server aware of Neovim runtime files
  21. library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true},
  22. maxPreload = 10000
  23. }
  24. }
  25. }
  26. }