config.lua 3.8 KB

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