config.lua 3.8 KB

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