config.lua 3.5 KB

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