config.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. "solc",
  26. "solidity_ls",
  27. "sorbet",
  28. "sourcekit",
  29. "sourcery",
  30. "spectral",
  31. "sqlls",
  32. "sqls",
  33. "stylelint_lsp",
  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 = lvim.icons.diagnostics.Error },
  48. { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning },
  49. { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint },
  50. { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Info },
  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 code = d.code or (d.user_data and d.user_data.lsp.code)
  66. if code then
  67. return string.format("%s [%s]", d.message, code):gsub("1. ", "")
  68. end
  69. return d.message
  70. end,
  71. },
  72. },
  73. document_highlight = false,
  74. code_lens_refresh = true,
  75. float = {
  76. focusable = true,
  77. style = "minimal",
  78. border = "rounded",
  79. },
  80. on_attach_callback = nil,
  81. on_init_callback = nil,
  82. automatic_configuration = {
  83. ---@usage list of servers that the automatic installer will skip
  84. skipped_servers = skipped_servers,
  85. ---@usage list of filetypes that the automatic installer will skip
  86. skipped_filetypes = skipped_filetypes,
  87. },
  88. buffer_mappings = {
  89. normal_mode = {
  90. ["K"] = { vim.lsp.buf.hover, "Show hover" },
  91. ["gd"] = { vim.lsp.buf.definition, "Goto Definition" },
  92. ["gD"] = { vim.lsp.buf.declaration, "Goto declaration" },
  93. ["gr"] = { vim.lsp.buf.references, "Goto references" },
  94. ["gI"] = { vim.lsp.buf.implementation, "Goto Implementation" },
  95. ["gs"] = { vim.lsp.buf.signature_help, "show signature help" },
  96. ["gl"] = {
  97. function()
  98. local config = lvim.lsp.diagnostics.float
  99. config.scope = "line"
  100. vim.diagnostic.open_float(0, config)
  101. end,
  102. "Show line diagnostics",
  103. },
  104. },
  105. insert_mode = {},
  106. visual_mode = {},
  107. },
  108. buffer_options = {
  109. --- enable completion triggered by <c-x><c-o>
  110. omnifunc = "v:lua.vim.lsp.omnifunc",
  111. --- use gq for formatting
  112. formatexpr = "v:lua.vim.lsp.formatexpr(#{timeout_ms:500})",
  113. },
  114. ---@usage list of settings of nvim-lsp-installer
  115. installer = {
  116. setup = {
  117. ensure_installed = {},
  118. automatic_installation = {
  119. exclude = {},
  120. },
  121. },
  122. },
  123. nlsp_settings = {
  124. setup = {
  125. config_home = join_paths(get_config_dir(), "lsp-settings"),
  126. -- set to false to overwrite schemastore.nvim
  127. append_default_schemas = true,
  128. ignored_servers = {},
  129. loader = "json",
  130. },
  131. },
  132. null_ls = {
  133. setup = {
  134. debug = false,
  135. },
  136. config = {},
  137. },
  138. ---@deprecated use lvim.lsp.automatic_configuration.skipped_servers instead
  139. override = {},
  140. ---@deprecated use lvim.lsp.installer.setup.automatic_installation instead
  141. automatic_servers_installation = nil,
  142. }