0
0

lsp.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. return {
  2. {
  3. "neovim/nvim-lspconfig",
  4. enabled = true,
  5. lazy = false,
  6. dependencies = { "williamboman/mason-lspconfig.nvim" },
  7. config = function(_, _)
  8. -- Install and configure servers
  9. require("mason").setup()
  10. require("mason-lspconfig").setup({
  11. ensure_installed = {
  12. "arduino_language_server", "basedpyright", "bashls", "clangd",
  13. "cssls", "denols", "gopls", "html", "jsonls",
  14. "kotlin_language_server", "lemminx", "lua_ls", "marksman",
  15. "mypy", "ruff_lsp", "rust_analyzer", "sqlls", "taplo",
  16. "terraformls", "tsserver", "yamlls"
  17. }
  18. })
  19. -- Configuration on attach
  20. vim.api.nvim_create_autocmd("LspAttach", {
  21. group = vim.api.nvim_create_augroup("UserLspConfig", {}),
  22. callback = function(_)
  23. vim.keymap.set("n", "SR", vim.lsp.buf.rename)
  24. vim.keymap.set("n", "Sx", vim.lsp.buf.code_action)
  25. vim.keymap.set("n", "SI", function()
  26. vim.lsp.inlay_hint.enable(
  27. not vim.lsp.inlay_hint.is_enabled())
  28. end)
  29. vim.keymap.set("n", "<Space>", vim.lsp.buf.hover)
  30. end
  31. })
  32. end
  33. }, {
  34. "williamboman/mason-lspconfig.nvim",
  35. enabled = true,
  36. lazy = false,
  37. automatic_installation = true,
  38. dependencies = { "williamboman/mason.nvim" }
  39. }, {
  40. "williamboman/mason.nvim",
  41. enabled = true,
  42. lazy = false,
  43. build = ":MasonUpdate"
  44. }
  45. }