lua-ls.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
  2. -- TODO fix for different systems and put variable for user
  3. -- local system_name
  4. -- if vim.fn.has("mac") == 1 then
  5. -- system_name = "macOS"
  6. -- elseif vim.fn.has("unix") == 1 then
  7. -- system_name = "Linux"
  8. -- elseif vim.fn.has('win32') == 1 then
  9. -- system_name = "Windows"
  10. -- else
  11. -- print("Unsupported system for sumneko")
  12. -- end
  13. -- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
  14. local sumneko_root_path = "/Users/chris/.config/nvim/lua-language-server"
  15. local sumneko_binary = "/Users/chris/.config/nvim/lua-language-server/bin/macOS/lua-language-server"
  16. require'lspconfig'.sumneko_lua.setup {
  17. cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
  18. settings = {
  19. Lua = {
  20. runtime = {
  21. -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
  22. version = 'LuaJIT',
  23. -- Setup your lua path
  24. path = vim.split(package.path, ';'),
  25. },
  26. diagnostics = {
  27. -- Get the language server to recognize the `vim` global
  28. globals = {'vim'},
  29. },
  30. workspace = {
  31. -- Make the server aware of Neovim runtime files
  32. library = {
  33. [vim.fn.expand('$VIMRUNTIME/lua')] = true,
  34. [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
  35. },
  36. },
  37. },
  38. },
  39. }