diff --git a/lua/astrocommunity/pack/rego/README.md b/lua/astrocommunity/pack/rego/README.md new file mode 100644 index 000000000..023cee21f --- /dev/null +++ b/lua/astrocommunity/pack/rego/README.md @@ -0,0 +1,7 @@ +# OPA Rego Pack + +This plugin pack does the following: + +- Adds `rego` Treesitter parser +- Adds `regols` language server +- Adds `opacheck` linter diff --git a/lua/astrocommunity/pack/rego/init.lua b/lua/astrocommunity/pack/rego/init.lua new file mode 100644 index 000000000..bfcf3b78d --- /dev/null +++ b/lua/astrocommunity/pack/rego/init.lua @@ -0,0 +1,47 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + optional = true, + opts = function(_, opts) + if opts.ensure_installed ~= "all" then + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "rego" }) + end + end, + }, + { + "williamboman/mason-lspconfig.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "regols" }) + end, + }, + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + if vim.fn.executable "opa" == 1 then + local nls = require "null-ls" + if not opts.sources then opts.sources = {} end + opts.sources = vim.list_extend(opts.sources, { + nls.builtins.diagnostics.opacheck, + }) + end + end, + }, + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + optional = true, + opts = function(_, opts) + opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "regols" }) + end, + }, + { + "mfussenegger/nvim-lint", + optional = true, + opts = { + linters_by_ft = { + rego = { "opa_check" }, + }, + }, + }, +}