From bb389529476eea86151649d094e1328429a12867 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Mon, 1 May 2023 13:25:53 -0400 Subject: [PATCH] refactor(plugins): simplify list_insert_unique calls --- plugins/mason.lua | 9 +++------ plugins/treesitter.lua | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins/mason.lua b/plugins/mason.lua index b202fef..6566f34 100644 --- a/plugins/mason.lua +++ b/plugins/mason.lua @@ -6,8 +6,7 @@ return { -- overrides `require("mason-lspconfig").setup(...)` opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - if not opts.ensure_installed then opts.ensure_installed = {} end - require("astronvim.utils").list_insert_unique(opts.ensure_installed, { + opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, { -- "lua_ls", }) end, @@ -18,8 +17,7 @@ return { -- overrides `require("mason-null-ls").setup(...)` opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - if not opts.ensure_installed then opts.ensure_installed = {} end - require("astronvim.utils").list_insert_unique(opts.ensure_installed, { + opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, { -- "prettier", -- "stylua", }) @@ -30,8 +28,7 @@ return { -- overrides `require("mason-nvim-dap").setup(...)` opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - if not opts.ensure_installed then opts.ensure_installed = {} end - require("astronvim.utils").list_insert_unique(opts.ensure_installed, { + opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, { -- "python", }) end, diff --git a/plugins/treesitter.lua b/plugins/treesitter.lua index acffc4e..18c6da6 100644 --- a/plugins/treesitter.lua +++ b/plugins/treesitter.lua @@ -2,8 +2,7 @@ return { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) -- add more things to the ensure_installed table protecting against community packs modifying it - if not opts.ensure_installed then opts.ensure_installed = {} end - require("astronvim.utils").list_insert_unique(opts.ensure_installed, { + opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, { -- "lua" }) end,