refactor: use lazy's new opts_extend functionality for treesitter and mason

This commit is contained in:
Folke Lemaitre
2024-06-07 09:03:59 +02:00
parent f70d350085
commit ab41ff551b
33 changed files with 54 additions and 219 deletions

View File

@ -7,11 +7,7 @@ return {
end,
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
-- for ansiblels validation
vim.list_extend(opts.ensure_installed, { "ansible-lint" })
end,
opts = { ensure_installed = { "ansible-lint" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -15,11 +15,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "astro" })
end
end,
opts = { ensure_installed = { "astro" } },
},
-- LSP Servers

View File

@ -16,11 +16,7 @@ return {
-- Add C/C++ to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "cpp" })
end
end,
opts = { ensure_installed = { "cpp" } },
},
{
@ -120,11 +116,7 @@ return {
-- Ensure C/C++ debugger is installed
"williamboman/mason.nvim",
optional = true,
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "codelldb" })
end
end,
opts = { ensure_installed = { "codelldb" } },
},
opts = function()
local dap = require("dap")

View File

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "cmake" })
end
end,
opts = { ensure_installed = { "cmake" } },
},
{
"nvimtools/none-ls.nvim",
@ -34,10 +30,7 @@ return {
},
{
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "cmakelang", "cmakelint" })
end,
opts = { ensure_installed = { "cmakelang", "cmakelint" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -7,18 +7,11 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "dockerfile" })
end
end,
opts = { ensure_installed = { "dockerfile" } },
},
{
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "hadolint" })
end,
opts = { ensure_installed = { "hadolint" } },
},
{
"nvimtools/none-ls.nvim",

View File

@ -7,13 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"elixir",
"heex",
"eex",
})
end,
opts = { ensure_installed = { "elixir", "heex", "eex" } },
},
{
"nvim-neotest/neotest",

View File

@ -6,19 +6,12 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "elm" })
end
end,
opts = { ensure_installed = { "elm" } },
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "elm-format" })
end,
opts = { ensure_installed = { "elm-format" } },
},
{

View File

@ -5,19 +5,13 @@ return {
-- Treesitter git support
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "git_config", "gitcommit", "git_rebase", "gitignore", "gitattributes" })
end,
opts = { ensure_installed = { "git_config", "gitcommit", "git_rebase", "gitignore", "gitattributes" } },
},
{
"nvim-cmp",
dependencies = {
{
"petertriho/cmp-git",
opts = {},
},
{ "petertriho/cmp-git", opts = {} },
},
---@module 'cmp'
---@param opts cmp.ConfigSchema

View File

@ -6,11 +6,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "gleam" })
end
end,
opts = { ensure_installed = { "gleam" } },
},
{

View File

@ -7,14 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"go",
"gomod",
"gowork",
"gosum",
})
end,
opts = { ensure_installed = { "go", "gomod", "gowork", "gosum" } },
},
{
"neovim/nvim-lspconfig",
@ -90,10 +83,7 @@ return {
-- Ensure Go tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt" })
end,
opts = { ensure_installed = { "goimports", "gofumpt" } },
},
{
"nvimtools/none-ls.nvim",
@ -101,10 +91,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl" })
end,
opts = { ensure_installed = { "gomodifytags", "impl" } },
},
},
opts = function(_, opts)
@ -132,10 +119,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "delve" })
end,
opts = { ensure_installed = { "delve" } },
},
{
"leoluz/nvim-dap-go",

View File

@ -9,11 +9,7 @@ return {
-- Add Haskell to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "haskell" })
end
end,
opts = { ensure_installed = { "haskell" } },
},
{
@ -33,10 +29,7 @@ return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-language-server" })
end,
opts = { ensure_installed = { "haskell-language-server" } },
},
{
@ -45,10 +38,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "haskell-debug-adapter" })
end,
opts = { ensure_installed = { "haskell-debug-adapter" } },
},
},
},

View File

@ -16,7 +16,11 @@ return {
})
end,
{ "towolf/vim-helm", ft = "helm" },
{
"nvim-treesitter/nvim-treesitter",
opts = { ensure_installed = { "helm" } },
},
{
"neovim/nvim-lspconfig",
opts = {

View File

@ -33,10 +33,7 @@ return {
-- Add java to treesitter.
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java" })
end,
opts = { ensure_installed = { "java" } },
},
-- Ensure java debugger and test packages are installed.
@ -46,10 +43,7 @@ return {
dependencies = {
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" })
end,
opts = { ensure_installed = { "java-debug-adapter", "java-test" } },
},
},
},

View File

@ -9,11 +9,7 @@ return {
-- add json to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "json5" })
end
end,
opts = { ensure_installed = { "json5" } },
},
-- yaml schema support

View File

@ -15,16 +15,12 @@ return {
-- Add packages(linting, debug adapter)
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "ktlint" })
end,
opts = { ensure_installed = { "ktlint" } },
},
-- Add syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed or {}, { "kotlin" })
end,
opts = { ensure_installed = { "kotlin" } },
},
-- Add language server
{

View File

@ -17,10 +17,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "markdownlint", "markdown-toc" })
end,
opts = { ensure_installed = { "markdownlint", "markdown-toc" } },
},
{
"nvimtools/none-ls.nvim",

View File

@ -5,10 +5,7 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "nix" })
end,
opts = { ensure_installed = { "nix" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -9,11 +9,7 @@ return {
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "c_sharp" })
end
end,
opts = { ensure_installed = { "c_sharp" } },
},
{
"nvimtools/none-ls.nvim",
@ -41,11 +37,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "netcoredbg", "csharpier" })
end
end,
opts = { ensure_installed = { "csharpier", "netcoredbg" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -6,9 +6,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "php" })
end,
opts = { ensure_installed = { "php" } },
},
{
@ -25,11 +23,7 @@ return {
optional = true,
dependencies = {
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
table.insert(opts.ensure_installed, "php-debug-adapter")
end
end,
opts = { ensure_installed = { "php-debug-adapter" } },
},
opts = function()
local dap = require("dap")

View File

@ -24,11 +24,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "ninja", "rst" })
end
end,
opts = { ensure_installed = { "ninja", "rst" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -59,11 +59,7 @@ return {
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "r", "rnoweb" })
end
end,
opts = { ensure_installed = { "r", "rnoweb" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"ruby",
})
end,
opts = { ensure_installed = { "ruby" } },
},
{
"neovim/nvim-lspconfig",

View File

@ -30,20 +30,14 @@ return {
-- Add Rust & related to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "ron", "rust" })
end,
opts = { ensure_installed = { "rust", "ron" } },
},
-- Ensure Rust debugger is installed
{
"williamboman/mason.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "codelldb" })
end,
opts = { ensure_installed = { "codelldb" } },
},
{

View File

@ -7,11 +7,7 @@ return {
end,
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "scala" })
end
end,
opts = { ensure_installed = { "scala" } },
},
{
"scalameta/nvim-metals",

View File

@ -67,11 +67,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "sql" })
end
end,
opts = { ensure_installed = { "sql" } },
},
-- Edgy integration
@ -99,10 +95,7 @@ return {
-- Linters & formatters
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "sqlfluff" })
end,
opts = { ensure_installed = { "sqlfluff" } },
},
{
"mfussenegger/nvim-lint",

View File

@ -15,11 +15,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "svelte" })
end
end,
opts = { ensure_installed = { "svelte" } },
},
-- LSP Servers

View File

@ -8,14 +8,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, {
"terraform",
"hcl",
})
end
end,
opts = { ensure_installed = { "terraform", "hcl" } },
},
{
"neovim/nvim-lspconfig",
@ -28,10 +21,7 @@ return {
-- ensure terraform tools are installed
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "tflint" })
end,
opts = { ensure_installed = { "tflint" } },
},
{
"nvimtools/none-ls.nvim",

View File

@ -5,11 +5,7 @@ return {
},
{
"nvim-treesitter",
optional = true,
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "thrift" })
end,
opts = { ensure_installed = { "thrift" } },
},
{
"nvim-lspconfig",

View File

@ -11,11 +11,7 @@ return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "vue" })
end
end,
opts = { ensure_installed = { "vue" } },
},
-- Add LSP servers

View File

@ -19,10 +19,7 @@ return {
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "shellcheck" })
end,
opts = { ensure_installed = { "shellcheck" } },
},
-- add some stuff to treesitter
{

Some files were not shown because too many files have changed in this diff Show More