Skip to content

Commit

Permalink
feat(pack): add Rego language pack (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter authored May 11, 2024
1 parent 172024f commit 9018562
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/astrocommunity/pack/rego/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# OPA Rego Pack

This plugin pack does the following:

- Adds `rego` Treesitter parser
- Adds `regols` language server
- Adds `opacheck` linter
47 changes: 47 additions & 0 deletions lua/astrocommunity/pack/rego/init.lua
Original file line number Diff line number Diff line change
@@ -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" },
},
},
},
}

0 comments on commit 9018562

Please sign in to comment.