config.lua 3.7 KB

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