config.lua 3.9 KB

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