config.lua 3.7 KB

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