lua.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua
  2. local runtime_path = vim.split(package.path, ";")
  3. table.insert(runtime_path, "lua/?.lua")
  4. table.insert(runtime_path, "lua/?/init.lua")
  5. local common = require("lsp.common-config")
  6. local opts = {
  7. capabilities = common.capabilities,
  8. flags = common.flags,
  9. on_attach = function(client, bufnr)
  10. common.disableFormat(client)
  11. common.keyAttach(bufnr)
  12. end,
  13. settings = {
  14. Lua = {
  15. runtime = {
  16. -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
  17. version = "LuaJIT",
  18. -- Setup your lua path
  19. path = runtime_path,
  20. },
  21. diagnostics = {
  22. -- Get the language server to recognize the `vim` global
  23. globals = { "vim" },
  24. },
  25. workspace = {
  26. -- Make the server aware of Neovim runtime files
  27. library = vim.api.nvim_get_runtime_file("", true),
  28. checkThirdParty = false,
  29. },
  30. -- Do not send telemetry data containing a randomized but unique identifier
  31. telemetry = {
  32. enable = false,
  33. },
  34. },
  35. },
  36. -- custom handler
  37. -- handlers = {
  38. -- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
  39. -- virtual_text = false,
  40. -- signs = true,
  41. -- underline = true,
  42. -- update_in_insert = false,
  43. -- }),
  44. -- },
  45. }
  46. return {
  47. on_setup = function(server)
  48. require("neodev").setup()
  49. server.setup(opts)
  50. end,
  51. }