config.lua 3.7 KB

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