From 4af9d8ed011402606a382459e3d51acc5f44a95a Mon Sep 17 00:00:00 2001 From: sadan <117494111+sadan4@users.noreply.github.com> Date: Tue, 28 May 2024 00:15:08 -0400 Subject: [PATCH] add mason autodownloader --- lua/masonDownload.lua | 17 +++++++++++++++++ lua/setup.lua | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 lua/masonDownload.lua diff --git a/lua/masonDownload.lua b/lua/masonDownload.lua new file mode 100644 index 0000000..69d61f9 --- /dev/null +++ b/lua/masonDownload.lua @@ -0,0 +1,17 @@ +local pkgs = { + "nixpkgs-fmt", + "jdtls", + "yaml-language-server", + "eslint_d", +} +local reg = require("mason-registry") +for _, pname in ipairs(pkgs) do + local pkg = reg.get_package(pname) + if not pkg:is_installed() then + print(string.format("[masonDownload.lua]: %s is not installed. Installing.", pname)) + local handle = pkg:install(nil) + --while handle.state ~= "CLOSED" do + -- print(handle.stdout) + -- end + end +end diff --git a/lua/setup.lua b/lua/setup.lua index 1daad3d..a8d9dce 100644 --- a/lua/setup.lua +++ b/lua/setup.lua @@ -4,6 +4,8 @@ vim.cmd([[colorscheme tokyonight]]) require("mason").setup() require("mason-lspconfig").setup() +require("masonDownload") + require("setuplsp") require("setupformat")