mason.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. local status, mason = pcall(require, "mason")
  2. if not status then
  3. return
  4. end
  5. local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig")
  6. if not mason_lspconfig_status then
  7. return
  8. end
  9. -- import mason-null-ls plugin safely
  10. local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls")
  11. if not mason_null_ls_status then
  12. return
  13. end
  14. mason.setup({
  15. ui = {
  16. icons = {
  17. package_installed = "✓",
  18. package_pending = "➜",
  19. package_uninstalled = "✗",
  20. },
  21. },
  22. })
  23. mason_lspconfig.setup({
  24. ensure_installed = {
  25. "tsserver",
  26. "volar",
  27. "html",
  28. "cssls",
  29. "tailwindcss",
  30. "lua_ls",
  31. "bashls",
  32. "jsonls",
  33. },
  34. automatic_installation = true,
  35. })
  36. mason_null_ls.setup({
  37. -- list of formatters & linters for mason to install
  38. ensure_installed = {
  39. "prettier", -- ts/js formatter
  40. "stylua", -- lua formatter
  41. "eslint_d", -- ts/js linter
  42. },
  43. -- auto configured formatters & linters (with null-ls)
  44. automatic_installation = true,
  45. })