config.lua 3.7 KB

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