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