config.lua 3.7 KB

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