config.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. local skipped_servers = {
  2. "angularls",
  3. "ansiblels",
  4. "ccls",
  5. "csharp_ls",
  6. "cssmodules_ls",
  7. "denols",
  8. "ember",
  9. "emmet_ls",
  10. "eslint",
  11. "eslintls",
  12. "glint",
  13. "golangci_lint_ls",
  14. "gradle_ls",
  15. "graphql",
  16. "jedi_language_server",
  17. "ltex",
  18. "neocmake",
  19. "ocamlls",
  20. "phpactor",
  21. "psalm",
  22. "pylsp",
  23. "pyre",
  24. "quick_lint_js",
  25. "reason_ls",
  26. "rnix",
  27. "rome",
  28. "ruby_ls",
  29. "ruff_lsp",
  30. "scry",
  31. "solang",
  32. "solc",
  33. "solidity_ls",
  34. "sorbet",
  35. "sourcekit",
  36. "sourcery",
  37. "spectral",
  38. "sqlls",
  39. "sqls",
  40. "stylelint_lsp",
  41. "svlangserver",
  42. "tflint",
  43. "verible",
  44. "vtsls",
  45. "vuels",
  46. }
  47. local skipped_filetypes = { "markdown", "rst", "plaintext", "toml", "proto" }
  48. local join_paths = require("lvim.utils").join_paths
  49. return {
  50. templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"),
  51. diagnostics = {
  52. signs = {
  53. active = true,
  54. values = {
  55. { name = "DiagnosticSignError", text = lvim.icons.diagnostics.Error },
  56. { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning },
  57. { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint },
  58. { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Information },
  59. },
  60. },
  61. virtual_text = true,
  62. update_in_insert = false,
  63. underline = true,
  64. severity_sort = true,
  65. float = {
  66. focusable = true,
  67. style = "minimal",
  68. border = "rounded",
  69. source = "always",
  70. header = "",
  71. prefix = "",
  72. format = function(d)
  73. local code = d.code or (d.user_data and d.user_data.lsp.code)
  74. if code then
  75. return string.format("%s [%s]", d.message, code):gsub("1. ", "")
  76. end
  77. return d.message
  78. end,
  79. },
  80. },
  81. document_highlight = false,
  82. code_lens_refresh = true,
  83. float = {
  84. focusable = true,
  85. style = "minimal",
  86. border = "rounded",
  87. },
  88. on_attach_callback = nil,
  89. on_init_callback = nil,
  90. automatic_configuration = {
  91. ---@usage list of servers that the automatic installer will skip
  92. skipped_servers = skipped_servers,
  93. ---@usage list of filetypes that the automatic installer will skip
  94. skipped_filetypes = skipped_filetypes,
  95. },
  96. buffer_mappings = {
  97. normal_mode = {
  98. ["K"] = { "<cmd>lua vim.lsp.buf.hover()<cr>", "Show hover" },
  99. ["gd"] = { "<cmd>lua vim.lsp.buf.definition()<cr>", "Goto Definition" },
  100. ["gD"] = { "<cmd>lua vim.lsp.buf.declaration()<cr>", "Goto declaration" },
  101. ["gr"] = { "<cmd>lua vim.lsp.buf.references()<cr>", "Goto references" },
  102. ["gI"] = { "<cmd>lua vim.lsp.buf.implementation()<cr>", "Goto Implementation" },
  103. ["gs"] = { "<cmd>lua vim.lsp.buf.signature_help()<cr>", "show signature help" },
  104. ["gl"] = {
  105. function()
  106. local config = lvim.lsp.diagnostics.float
  107. config.scope = "line"
  108. vim.diagnostic.open_float(0, config)
  109. end,
  110. "Show line diagnostics",
  111. },
  112. },
  113. insert_mode = {},
  114. visual_mode = {},
  115. },
  116. buffer_options = {
  117. --- enable completion triggered by <c-x><c-o>
  118. omnifunc = "v:lua.vim.lsp.omnifunc",
  119. --- use gq for formatting
  120. formatexpr = "v:lua.vim.lsp.formatexpr(#{timeout_ms:500})",
  121. },
  122. ---@usage list of settings of nvim-lsp-installer
  123. installer = {
  124. setup = {
  125. ensure_installed = {},
  126. automatic_installation = {
  127. exclude = {},
  128. },
  129. },
  130. },
  131. nlsp_settings = {
  132. setup = {
  133. config_home = join_paths(get_config_dir(), "lsp-settings"),
  134. -- set to false to overwrite schemastore.nvim
  135. append_default_schemas = true,
  136. ignored_servers = {},
  137. loader = "json",
  138. },
  139. },
  140. null_ls = {
  141. setup = {
  142. debug = false,
  143. },
  144. config = {},
  145. },
  146. ---@deprecated use lvim.lsp.automatic_configuration.skipped_servers instead
  147. override = {},
  148. ---@deprecated use lvim.lsp.installer.setup.automatic_installation instead
  149. automatic_servers_installation = nil,
  150. }