diff --git a/lua/astrocommunity/editing-support/nvim-regexplainer/nvim-regexplainer.lua b/lua/astrocommunity/editing-support/nvim-regexplainer/nvim-regexplainer.lua index 5778f7aa6..1274e748c 100644 --- a/lua/astrocommunity/editing-support/nvim-regexplainer/nvim-regexplainer.lua +++ b/lua/astrocommunity/editing-support/nvim-regexplainer/nvim-regexplainer.lua @@ -9,14 +9,10 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + -- add regex to treesitters + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "regex") end - -- Add the "regex" parser to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "regex") end, }, } diff --git a/lua/astrocommunity/pack/astro/astro.lua b/lua/astrocommunity/pack/astro/astro.lua index c640d12e8..237638466 100644 --- a/lua/astrocommunity/pack/astro/astro.lua +++ b/lua/astrocommunity/pack/astro/astro.lua @@ -4,31 +4,17 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "astro") end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "astro") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add tsserver to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "astro") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "astro") end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "js") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "js") end, }, } diff --git a/lua/astrocommunity/pack/bash/bash.lua b/lua/astrocommunity/pack/bash/bash.lua index c1d596c4f..2cc90618f 100644 --- a/lua/astrocommunity/pack/bash/bash.lua +++ b/lua/astrocommunity/pack/bash/bash.lua @@ -3,41 +3,23 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "bash") end - -- Add the "julia" and "toml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "bash") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add julia lsp and toml lsp to ensure_installed - utils.list_insert_unique(opts.ensure_installed, "bashls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "bashls") end, }, { "jay-babu/mason-null-ls.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add julia lsp and toml lsp to ensure_installed - utils.list_insert_unique(opts.ensure_installed, { "shellcheck", "shfmt" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "shellcheck", "shfmt" }) end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add julia lsp and toml lsp to ensure_installed - utils.list_insert_unique(opts.ensure_installed, "bash") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "bash") end, }, } diff --git a/lua/astrocommunity/pack/cmake/cmake.lua b/lua/astrocommunity/pack/cmake/cmake.lua index 79cb957e3..44f302532 100644 --- a/lua/astrocommunity/pack/cmake/cmake.lua +++ b/lua/astrocommunity/pack/cmake/cmake.lua @@ -3,21 +3,13 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "cmake") end - utils.list_insert_unique(opts.ensure_installed, "cmake") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "neocmake") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "neocmake") end, }, } diff --git a/lua/astrocommunity/pack/dart/dart.lua b/lua/astrocommunity/pack/dart/dart.lua index c6d8cac4b..15c2032d7 100644 --- a/lua/astrocommunity/pack/dart/dart.lua +++ b/lua/astrocommunity/pack/dart/dart.lua @@ -4,20 +4,15 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "dart") end - -- Add the "dart" and "yaml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "dart") end, }, { "akinsho/flutter-tools.nvim", ft = { "dart" }, - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "dartls") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "dartls") end, opts = { lsp = require("astronvim.utils.lsp").config "dartls", debugger = { @@ -28,11 +23,7 @@ return { { "nvim-lua/plenary.nvim" }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "dart") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "dart") end, }, }, }, diff --git a/lua/astrocommunity/pack/go/go.lua b/lua/astrocommunity/pack/go/go.lua index e889d7429..4b0a07341 100644 --- a/lua/astrocommunity/pack/go/go.lua +++ b/lua/astrocommunity/pack/go/go.lua @@ -4,33 +4,22 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "go") end - -- Add the "go" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "go") end, }, { "jay-babu/mason-null-ls.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add go lsps to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, { "gomodifytags", "gofumpt", "iferr", "impl", "goimports" }) + opts.ensure_installed = + utils.list_insert_unique(opts.ensure_installed, { "gomodifytags", "gofumpt", "iferr", "impl", "goimports" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "gopls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "gopls") end, }, { "leoluz/nvim-dap-go", @@ -39,11 +28,7 @@ return { "mfussenegger/nvim-dap", { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "delve") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "delve") end, }, }, opts = {}, diff --git a/lua/astrocommunity/pack/haskell/haskell.lua b/lua/astrocommunity/pack/haskell/haskell.lua index 11123a1ae..5fa359899 100644 --- a/lua/astrocommunity/pack/haskell/haskell.lua +++ b/lua/astrocommunity/pack/haskell/haskell.lua @@ -5,21 +5,16 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haskell") end - -- ensure haskell treesitter installed - utils.list_insert_unique(opts.ensure_installed, "haskell") end, }, { "mrcjkb/haskell-tools.nvim", ft = { "haskell" }, branch = "1.x.x", -- reccomended by haskell-tools - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "hls") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "hls") end, opts = { hls = { on_attach = function(client, bufnr) require("astronvim.utils.lsp").on_attach(client, bufnr) end, @@ -37,20 +32,12 @@ return { -- TODO: Need haskell to be pulled into mason-nvim-dap (haskell hopefully coming soon) -- { -- "jay-babu/mason-nvim-dap.nvim", - -- opts = function(_, opts) - -- -- Ensure that opts.ensure_installed exists and is a table. - -- if not opts.ensure_installed then opts.ensure_installed = {} end - -- utils.list_insert_unique(opts.ensure_installed, "haskell-dap") - -- end, + -- opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haskell") end, -- }, }, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "hls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "hls") end, }, } diff --git a/lua/astrocommunity/pack/haxe/haxe.lua b/lua/astrocommunity/pack/haxe/haxe.lua index 0bb436c23..18fdffa28 100644 --- a/lua/astrocommunity/pack/haxe/haxe.lua +++ b/lua/astrocommunity/pack/haxe/haxe.lua @@ -15,9 +15,7 @@ return { { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "haxe_language_server") + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "haxe_language_server") end, }, } diff --git a/lua/astrocommunity/pack/java/java.lua b/lua/astrocommunity/pack/java/java.lua index 6d1a9bc2a..3d16f1210 100644 --- a/lua/astrocommunity/pack/java/java.lua +++ b/lua/astrocommunity/pack/java/java.lua @@ -4,51 +4,34 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "java", "html" }) end - -- Add the "java" and "html" language to opts.ensure_installed. - -- XML does not have it's own treesitter plugin so HTML can take over if necessary - utils.list_insert_unique(opts.ensure_installed, { "java", "html" }) end, }, { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add jdtls and lemminx lsps to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, { "jdtls", "lemminx" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "jdtls", "lemminx" }) end, }, { "jay-babu/mason-null-ls.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add clang_format to opts.ensure_installed - utils.list_insert_unique(opts.ensure_installed, { "clang_format" }) - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "clang_format") end, }, { "jay-babu/mason-nvim-dap.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add javadgb to required - utils.list_insert_unique(opts.ensure_installed, { "javadbg", "javatest" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "javadbg", "javatest" }) end, }, { "mfussenegger/nvim-jdtls", ft = { "java" }, - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "jdtls") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "jdtls") end, opts = function(_, opts) -- use this function notation to build some variables local root_markers = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle", ".project" } diff --git a/lua/astrocommunity/pack/json/json.lua b/lua/astrocommunity/pack/json/json.lua index a6c22132c..7dbbae0ee 100644 --- a/lua/astrocommunity/pack/json/json.lua +++ b/lua/astrocommunity/pack/json/json.lua @@ -3,21 +3,13 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "json", "jsonc" }) end - utils.list_insert_unique(opts.ensure_installed, { "json", "jsonc" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "jsonls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "jsonls") end, }, } diff --git a/lua/astrocommunity/pack/julia/julia.lua b/lua/astrocommunity/pack/julia/julia.lua index 2a88183e5..3774cad73 100644 --- a/lua/astrocommunity/pack/julia/julia.lua +++ b/lua/astrocommunity/pack/julia/julia.lua @@ -4,24 +4,14 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "julia") end - -- Add the "julia" and "toml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "julia") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add julia lsp and toml lsp to ensure_installed - utils.list_insert_unique(opts.ensure_installed, "julials") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "julials") end, }, { "hrsh7th/nvim-cmp", diff --git a/lua/astrocommunity/pack/lua/lua.lua b/lua/astrocommunity/pack/lua/lua.lua index a2836684a..f80980542 100644 --- a/lua/astrocommunity/pack/lua/lua.lua +++ b/lua/astrocommunity/pack/lua/lua.lua @@ -3,29 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "lua", "luap" }) end - utils.list_insert_unique(opts.ensure_installed, { "lua", "luap" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "lua_ls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "lua_ls") end, }, { "jay-babu/mason-null-ls.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "stylua") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "stylua") end, }, } diff --git a/lua/astrocommunity/pack/markdown/markdown.lua b/lua/astrocommunity/pack/markdown/markdown.lua index a848924eb..7b843f4e9 100644 --- a/lua/astrocommunity/pack/markdown/markdown.lua +++ b/lua/astrocommunity/pack/markdown/markdown.lua @@ -3,29 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "markdown", "markdown_inline" }) end - utils.list_insert_unique(opts.ensure_installed, { "markdown", "markdown_inline" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "marksman") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "marksman") end, }, { "jay-babu/mason-null-ls.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "prettierd") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "prettierd") end, }, } diff --git a/lua/astrocommunity/pack/nix/nix.lua b/lua/astrocommunity/pack/nix/nix.lua index abfba5008..db62d93b2 100644 --- a/lua/astrocommunity/pack/nix/nix.lua +++ b/lua/astrocommunity/pack/nix/nix.lua @@ -3,23 +3,14 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "nix") end - -- Add the "nix" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "nix") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "rnix") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "rnix") end, }, { "jose-elias-alvarez/null-ls.nvim", diff --git a/lua/astrocommunity/pack/php/php.lua b/lua/astrocommunity/pack/php/php.lua index d4781b3d4..3c82cbf8f 100644 --- a/lua/astrocommunity/pack/php/php.lua +++ b/lua/astrocommunity/pack/php/php.lua @@ -3,32 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "php") end - -- Add the "python" and "toml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "php") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add pyright lsp to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "phpactor") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "phpactor") end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "php") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "php") end, }, } diff --git a/lua/astrocommunity/pack/prisma/prisma.lua b/lua/astrocommunity/pack/prisma/prisma.lua index 00a2b159f..b0c13dc6c 100644 --- a/lua/astrocommunity/pack/prisma/prisma.lua +++ b/lua/astrocommunity/pack/prisma/prisma.lua @@ -3,21 +3,13 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "prisma") end - utils.list_insert_unique(opts.ensure_installed, "prisma") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "prismals") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "prismals") end, }, } diff --git a/lua/astrocommunity/pack/python/python.lua b/lua/astrocommunity/pack/python/python.lua index a35d6bd2f..7170d9e6d 100644 --- a/lua/astrocommunity/pack/python/python.lua +++ b/lua/astrocommunity/pack/python/python.lua @@ -3,42 +3,26 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "python", "toml" }) end - -- Add the "python" and "toml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, { "python", "toml" }) end, }, { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add pyright lsp to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "pyright", "ruff_lsp" }) end, }, { "jay-babu/mason-null-ls.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, { "isort", "black", "pylint" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "isort", "black", "pylint" }) end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "python") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "python") end, }, { "linux-cultist/venv-selector.nvim", diff --git a/lua/astrocommunity/pack/rust/rust.lua b/lua/astrocommunity/pack/rust/rust.lua index 00a130511..e143f945f 100644 --- a/lua/astrocommunity/pack/rust/rust.lua +++ b/lua/astrocommunity/pack/rust/rust.lua @@ -4,20 +4,15 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "rust") end - -- Add the "rust" and "toml" language to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "rust") end, }, { "simrat39/rust-tools.nvim", ft = { "rust" }, - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "rust_analyzer") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "rust_analyzer") end, opts = function() local package_path = require("mason-registry").get_package("codelldb"):get_install_path() local codelldb_path = package_path .. "/codelldb" @@ -43,22 +38,13 @@ return { dependencies = { { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "codelldb") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "codelldb") end, }, }, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add rust and taplo lsps to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "rust_analyzer") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "rust_analyzer") end, }, { "Saecki/crates.nvim", diff --git a/lua/astrocommunity/pack/svelte/svelte.lua b/lua/astrocommunity/pack/svelte/svelte.lua index d6db08722..dc59d865e 100644 --- a/lua/astrocommunity/pack/svelte/svelte.lua +++ b/lua/astrocommunity/pack/svelte/svelte.lua @@ -3,32 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "svelte") end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "svelte") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add tsserver to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "svelte") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "svelte") end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "js") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "js") end, }, } diff --git a/lua/astrocommunity/pack/tailwindcss/tailwindcss.lua b/lua/astrocommunity/pack/tailwindcss/tailwindcss.lua index 1349a1074..12bfb5348 100644 --- a/lua/astrocommunity/pack/tailwindcss/tailwindcss.lua +++ b/lua/astrocommunity/pack/tailwindcss/tailwindcss.lua @@ -3,31 +3,21 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "css") end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "css") end, }, { "williamboman/mason-lspconfig.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add tsserver to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, { "tailwindcss", "cssls" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "tailwindcss", "cssls" }) end, }, { "jay-babu/mason-null-ls.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, { "prettierd", "rustywind" }) + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "prettierd", "rustywind" }) end, }, { diff --git a/lua/astrocommunity/pack/toml/toml.lua b/lua/astrocommunity/pack/toml/toml.lua index 21940b9b7..1fe49662d 100644 --- a/lua/astrocommunity/pack/toml/toml.lua +++ b/lua/astrocommunity/pack/toml/toml.lua @@ -4,21 +4,14 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "toml") end - utils.list_insert_unique(opts.ensure_installed, "toml") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "taplo") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "taplo") end, }, { "jay-babu/mason-null-ls.nvim", diff --git a/lua/astrocommunity/pack/typescript-deno/typescript.lua b/lua/astrocommunity/pack/typescript-deno/typescript.lua index 72660ba11..14020b585 100644 --- a/lua/astrocommunity/pack/typescript-deno/typescript.lua +++ b/lua/astrocommunity/pack/typescript-deno/typescript.lua @@ -5,37 +5,22 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" }) end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add denols to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "denols") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "denols") end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "js") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "js") end, }, { "sigmasd/deno-nvim", - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "denols") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "denols") end, ft = { "javascript", "typescript", "javascriptreact", "typescriptreact" }, opts = function() return { server = require("astronvim.utils.lsp").config "denols" } end, }, diff --git a/lua/astrocommunity/pack/typescript/typescript.lua b/lua/astrocommunity/pack/typescript/typescript.lua index 7d5a62bb3..5b25d7e05 100644 --- a/lua/astrocommunity/pack/typescript/typescript.lua +++ b/lua/astrocommunity/pack/typescript/typescript.lua @@ -21,33 +21,19 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" }) end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx" }) end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add tsserver to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "tsserver") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "tsserver") end, }, { "jay-babu/mason-null-ls.nvim", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add prettierd & eslint_d to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "prettierd") - utils.list_insert_unique(opts.ensure_installed, "eslint_d") + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "prettierd", "eslint_d" }) if not opts.handlers then opts.handlers = {} end @@ -77,12 +63,7 @@ return { }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "js") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "js") end, }, { "vuki656/package-info.nvim", @@ -92,7 +73,7 @@ return { }, { "jose-elias-alvarez/typescript.nvim", - init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "tsserver") end, + init = function() astronvim.lsp.skip_setup = utils.list_insert_unique(astronvim.lsp.skip_setup, "tsserver") end, ft = { "typescript", "typescriptreact", diff --git a/lua/astrocommunity/pack/vue/vue.lua b/lua/astrocommunity/pack/vue/vue.lua index 09a51e060..6293e7603 100644 --- a/lua/astrocommunity/pack/vue/vue.lua +++ b/lua/astrocommunity/pack/vue/vue.lua @@ -3,32 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "vue") end - -- Add the required file types to opts.ensure_installed. - utils.list_insert_unique(opts.ensure_installed, "vue") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add tsserver to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "volar") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "volar") end, }, { "jay-babu/mason-nvim-dap.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add to opts.ensure_installed using table.insert. - utils.list_insert_unique(opts.ensure_installed, "js") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "js") end, }, } diff --git a/lua/astrocommunity/pack/yaml/yaml.lua b/lua/astrocommunity/pack/yaml/yaml.lua index cdd1f548b..b36eadd04 100644 --- a/lua/astrocommunity/pack/yaml/yaml.lua +++ b/lua/astrocommunity/pack/yaml/yaml.lua @@ -3,30 +3,17 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table or string "all". - if not opts.ensure_installed then - opts.ensure_installed = {} - elseif opts.ensure_installed == "all" then - return + if opts.ensure_installed ~= "all" then + opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "yaml") end - utils.list_insert_unique(opts.ensure_installed, "yaml") end, }, { "williamboman/mason-lspconfig.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table - if not opts.ensure_installed then opts.ensure_installed = {} end - utils.list_insert_unique(opts.ensure_installed, "yamlls") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "yamlls") end, }, { "jay-babu/mason-null-ls.nvim", - opts = function(_, opts) - -- Ensure that opts.ensure_installed exists and is a table. - if not opts.ensure_installed then opts.ensure_installed = {} end - -- Add go lsps to opts.ensure_installed using vim.list_extend. - utils.list_insert_unique(opts.ensure_installed, "prettierd") - end, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "prettierd") end, }, } diff --git a/lua/astrocommunity/utility/noice-nvim/noice-nvim.lua b/lua/astrocommunity/utility/noice-nvim/noice-nvim.lua index 233724b68..fcc065d16 100644 --- a/lua/astrocommunity/utility/noice-nvim/noice-nvim.lua +++ b/lua/astrocommunity/utility/noice-nvim/noice-nvim.lua @@ -3,11 +3,10 @@ return { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) - if not opts.ensure_installed then opts.ensure_installed = {} end - if type(opts.ensure_installed) == "table" then - utils.list_insert_unique(opts.ensure_installed, { "bash", "markdown", "markdown_inline", "regex", "vim" }) + if opts.ensure_installed ~= "all" then + opts.ensure_installed = + utils.list_insert_unique(opts.ensure_installed, { "bash", "markdown", "markdown_inline", "regex", "vim" }) end - return opts end, }, {