aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorVu Le Thanh <thanhvule0310@gmail.com>2022-08-06 19:07:12 +0700
committerGitHub <noreply@github.com>2022-08-06 14:07:12 +0200
commit57347237668357eb81493754947af0271d26221b (patch)
tree8089014e402fcc940958d7664ef4d51e20e3fc63 /lua
parentchore: update generated code (#257) (diff)
downloadmason-57347237668357eb81493754947af0271d26221b.tar
mason-57347237668357eb81493754947af0271d26221b.tar.gz
mason-57347237668357eb81493754947af0271d26221b.tar.bz2
mason-57347237668357eb81493754947af0271d26221b.tar.lz
mason-57347237668357eb81493754947af0271d26221b.tar.xz
mason-57347237668357eb81493754947af0271d26221b.tar.zst
mason-57347237668357eb81493754947af0271d26221b.zip
feat: add buildifier, blade-formatter, blue, haml-lint, textlint, vulture, cfn-lint (#255)
Co-authored-by: William Boman <william@redwill.se>
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-registry/blade-formatter/init.lua11
-rw-r--r--lua/mason-registry/blue/init.lua17
-rw-r--r--lua/mason-registry/buildifier/init.lua34
-rw-r--r--lua/mason-registry/cfn-lint/init.lua15
-rw-r--r--lua/mason-registry/haml-lint/init.lua15
-rw-r--r--lua/mason-registry/index.lua7
-rw-r--r--lua/mason-registry/textlint/init.lua11
-rw-r--r--lua/mason-registry/vulture/init.lua19
-rw-r--r--lua/mason/mappings/language.lua13
-rw-r--r--lua/mason/ui/components/main/package_list.lua4
10 files changed, 140 insertions, 6 deletions
diff --git a/lua/mason-registry/blade-formatter/init.lua b/lua/mason-registry/blade-formatter/init.lua
new file mode 100644
index 00000000..1a16e183
--- /dev/null
+++ b/lua/mason-registry/blade-formatter/init.lua
@@ -0,0 +1,11 @@
+local Pkg = require "mason-core.package"
+local npm = require "mason-core.managers.npm"
+
+return Pkg.new {
+ name = "blade-formatter",
+ desc = [[An opinionated blade template formatter for Laravel that respects readability]],
+ homepage = "https://github.com/shufo/blade-formatter",
+ languages = { Pkg.Lang.Blade },
+ categories = { Pkg.Cat.Formatter },
+ install = npm.packages { "blade-formatter", bin = { "blade-formatter" } },
+}
diff --git a/lua/mason-registry/blue/init.lua b/lua/mason-registry/blue/init.lua
new file mode 100644
index 00000000..339d35d2
--- /dev/null
+++ b/lua/mason-registry/blue/init.lua
@@ -0,0 +1,17 @@
+local Pkg = require "mason-core.package"
+local pip3 = require "mason-core.managers.pip3"
+local _ = require "mason-core.functional"
+
+return Pkg.new {
+ name = "blue",
+ desc = _.dedent [[
+ blue is a somewhat less uncompromising code formatter than black, the OG of Python formatters. We love the idea
+ of automatically formatting Python code, for the same reasons that inspired black, however we take issue with
+ some of the decisions black makes. Kudos to black for pioneering code formatting for Python, and for its
+ excellent implementation.
+ ]],
+ homepage = "https://blue.readthedocs.io/en/latest/",
+ languages = { Pkg.Lang.Python },
+ categories = { Pkg.Cat.Formatter },
+ install = pip3.packages { "blue", bin = { "blue" } },
+}
diff --git a/lua/mason-registry/buildifier/init.lua b/lua/mason-registry/buildifier/init.lua
new file mode 100644
index 00000000..d245011e
--- /dev/null
+++ b/lua/mason-registry/buildifier/init.lua
@@ -0,0 +1,34 @@
+local Pkg = require "mason-core.package"
+local github = require "mason-core.managers.github"
+local std = require "mason-core.managers.std"
+local _ = require "mason-core.functional"
+local platform = require "mason-core.platform"
+
+local coalesce, when = _.coalesce, _.when
+
+return Pkg.new {
+ name = "buildifier",
+ desc = [[buildifier is a tool for formatting and linting bazel BUILD, WORKSPACE, and .bzl files.]],
+ homepage = "https://github.com/bazelbuild/buildtools",
+ languages = { Pkg.Lang.Bazel },
+ categories = { Pkg.Cat.Linter, Pkg.Cat.Formatter },
+ ---@async
+ ---@param ctx InstallContext
+ install = function(ctx)
+ github
+ .download_release_file({
+ repo = "bazelbuild/buildtools",
+ out_file = platform.is.win and "buildifier.exe" or "buildifier",
+ asset_file = coalesce(
+ when(platform.is.mac_x64, "buildifier-darwin-amd64"),
+ when(platform.is.mac_arm64, "buildifier-darwin-arm64"),
+ when(platform.is.linux_x64, "buildifier-linux-amd64"),
+ when(platform.is.linux_arm64, "buildifier-linux-arm64"),
+ when(platform.is.win_x64, "buildifier-windows-amd64.exe")
+ ),
+ })
+ .with_receipt()
+ std.chmod("+x", { "buildifier" })
+ ctx:link_bin("buildifier", platform.is.win and "buildifier.exe" or "buildifier")
+ end,
+}
diff --git a/lua/mason-registry/cfn-lint/init.lua b/lua/mason-registry/cfn-lint/init.lua
new file mode 100644
index 00000000..7eeee2f9
--- /dev/null
+++ b/lua/mason-registry/cfn-lint/init.lua
@@ -0,0 +1,15 @@
+local Pkg = require "mason-core.package"
+local pip3 = require "mason-core.managers.pip3"
+local _ = require "mason-core.functional"
+
+return Pkg.new {
+ name = "cfn-lint",
+ desc = _.dedent [[
+ CloudFormation Linter. Validate AWS CloudFormation YAML/JSON templates against the AWS CloudFormation Resource
+ Specification and additional checks. Includes checking valid values for resource properties and best practices.
+ ]],
+ homepage = "https://github.com/aws-cloudformation/cfn-lint",
+ languages = { Pkg.Lang.YAML, Pkg.Lang.JSON },
+ categories = { Pkg.Cat.Linter },
+ install = pip3.packages { "cfn-lint", bin = { "cfn-lint" } },
+}
diff --git a/lua/mason-registry/haml-lint/init.lua b/lua/mason-registry/haml-lint/init.lua
new file mode 100644
index 00000000..d6edabdd
--- /dev/null
+++ b/lua/mason-registry/haml-lint/init.lua
@@ -0,0 +1,15 @@
+local Pkg = require "mason-core.package"
+local gem = require "mason-core.managers.gem"
+local _ = require "mason-core.functional"
+
+return Pkg.new {
+ name = "haml-lint",
+ desc = _.dedent [[
+ haml-lint is a tool to help keep your HAML files clean and readable. In addition to HAML-specific style and lint
+ checks, it integrates with RuboCop to bring its powerful static analysis tools to your HAML documents.
+ ]],
+ homepage = "https://github.com/sds/haml-lint",
+ languages = { Pkg.Lang.HAML },
+ categories = { Pkg.Cat.Linter },
+ install = gem.packages { "haml_lint", bin = { "haml-lint" } },
+}
diff --git a/lua/mason-registry/index.lua b/lua/mason-registry/index.lua
index dd280326..65164bd5 100644
--- a/lua/mason-registry/index.lua
+++ b/lua/mason-registry/index.lua
@@ -15,8 +15,12 @@ return {
["beancount-language-server"] = "mason-registry.beancount-language-server",
["bicep-lsp"] = "mason-registry.bicep-lsp",
black = "mason-registry.black",
+ ["blade-formatter"] = "mason-registry.blade-formatter",
+ blue = "mason-registry.blue",
["bsl-language-server"] = "mason-registry.bsl-language-server",
buf = "mason-registry.buf",
+ buildifier = "mason-registry.buildifier",
+ ["cfn-lint"] = "mason-registry.cfn-lint",
["chrome-debug-adapter"] = "mason-registry.chrome-debug-adapter",
["clang-format"] = "mason-registry.clang-format",
clangd = "mason-registry.clangd",
@@ -79,6 +83,7 @@ return {
["graphql-language-service-cli"] = "mason-registry.graphql-language-service-cli",
["groovy-language-server"] = "mason-registry.groovy-language-server",
hadolint = "mason-registry.hadolint",
+ ["haml-lint"] = "mason-registry.haml-lint",
["haskell-language-server"] = "mason-registry.haskell-language-server",
["haxe-language-server"] = "mason-registry.haxe-language-server",
["hoon-language-server"] = "mason-registry.hoon-language-server",
@@ -173,6 +178,7 @@ return {
tectonic = "mason-registry.tectonic",
["terraform-ls"] = "mason-registry.terraform-ls",
texlab = "mason-registry.texlab",
+ textlint = "mason-registry.textlint",
tflint = "mason-registry.tflint",
["typescript-language-server"] = "mason-registry.typescript-language-server",
["vala-language-server"] = "mason-registry.vala-language-server",
@@ -184,6 +190,7 @@ return {
["visualforce-language-server"] = "mason-registry.visualforce-language-server",
vls = "mason-registry.vls",
["vue-language-server"] = "mason-registry.vue-language-server",
+ vulture = "mason-registry.vulture",
["wgsl-analyzer"] = "mason-registry.wgsl-analyzer",
["write-good"] = "mason-registry.write-good",
xo = "mason-registry.xo",
diff --git a/lua/mason-registry/textlint/init.lua b/lua/mason-registry/textlint/init.lua
new file mode 100644
index 00000000..c5126793
--- /dev/null
+++ b/lua/mason-registry/textlint/init.lua
@@ -0,0 +1,11 @@
+local Pkg = require "mason-core.package"
+local npm = require "mason-core.managers.npm"
+
+return Pkg.new {
+ name = "textlint",
+ desc = [[The pluggable natural language linter for text and markdown.]],
+ homepage = "https://textlint.github.io",
+ languages = { Pkg.Lang.Text, Pkg.Lang.Markdown },
+ categories = { Pkg.Cat.Linter },
+ install = npm.packages { "textlint", bin = { "textlint" } },
+}
diff --git a/lua/mason-registry/vulture/init.lua b/lua/mason-registry/vulture/init.lua
new file mode 100644
index 00000000..d6098f5c
--- /dev/null
+++ b/lua/mason-registry/vulture/init.lua
@@ -0,0 +1,19 @@
+local Pkg = require "mason-core.package"
+local pip3 = require "mason-core.managers.pip3"
+local _ = require "mason-core.functional"
+
+return Pkg.new {
+ name = "vulture",
+ desc = _.dedent [[
+ Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code
+ bases. If you run Vulture on both your library and test suite you can find untested code.
+
+ Due to Python's dynamic nature, static code analyzers like Vulture are likely to miss some dead code. Also, code
+ that is only called implicitly may be reported as unused. Nonetheless, Vulture can be a very helpful tool for
+ higher code quality.
+ ]],
+ homepage = "https://github.com/jendrikseipp/vulture",
+ languages = { Pkg.Lang.Python },
+ categories = { Pkg.Cat.Linter },
+ install = pip3.packages { "vulture", bin = { "vulture" } },
+}
diff --git a/lua/mason/mappings/language.lua b/lua/mason/mappings/language.lua
index fc83c0f4..e996c2bd 100644
--- a/lua/mason/mappings/language.lua
+++ b/lua/mason/mappings/language.lua
@@ -11,8 +11,10 @@ return {
astro = { "astro-language-server" },
awk = { "awk-language-server" },
bash = { "bash-debug-adapter", "bash-language-server", "shellcheck", "shellharden", "shfmt" },
+ bazel = { "buildifier" },
beancount = { "beancount-language-server" },
bicep = { "bicep-lsp" },
+ blade = { "blade-formatter" },
c = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
["c#"] = { "clang-format", "csharp-language-server", "csharpier", "netcoredbg", "omnisharp", "omnisharp-mono" },
["c++"] = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
@@ -43,6 +45,7 @@ return {
go = { "delve", "djlint", "go-debug-adapter", "gofumpt", "goimports", "golangci-lint", "golangci-lint-langserver", "golines", "gomodifytags", "gopls", "gotests", "impl", "json-to-struct", "revive", "staticcheck" },
graphql = { "graphql-language-service-cli", "prettier", "prettierd" },
groovy = { "groovy-language-server" },
+ haml = { "haml-lint" },
handlebargs = { "djlint" },
haskell = { "haskell-language-server" },
haxe = { "haxe-language-server" },
@@ -51,7 +54,7 @@ return {
java = { "clang-format", "jdtls" },
javascript = { "chrome-debug-adapter", "clang-format", "deno", "eslint-lsp", "eslint_d", "firefox-debug-adapter", "node-debug2-adapter", "prettier", "prettierd", "quick-lint-js", "rome", "typescript-language-server", "xo" },
jinja = { "curlylint", "djlint" },
- json = { "clang-format", "fixjson", "jq", "json-lsp", "prettier", "prettierd", "spectral-language-server" },
+ json = { "cfn-lint", "clang-format", "fixjson", "jq", "json-lsp", "prettier", "prettierd", "spectral-language-server" },
jsonnet = { "jsonnet-language-server" },
jsx = { "prettier", "prettierd" },
julia = { "julia-lsp" },
@@ -61,7 +64,7 @@ return {
less = { "css-lsp", "prettier", "prettierd" },
liquid = { "curlylint", "shopify-theme-check" },
lua = { "lemmy-help", "lua-language-server", "luacheck", "luaformatter", "selene", "stylua" },
- markdown = { "alex", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-language-server", "vale", "write-good", "zk" },
+ markdown = { "alex", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-language-server", "textlint", "vale", "write-good", "zk" },
["metamath zero"] = { "metamath-zero-lsp" },
mksh = { "shfmt" },
mustache = { "djlint" },
@@ -80,7 +83,7 @@ return {
protobuf = { "buf" },
puppet = { "puppet-editor-services" },
purescript = { "purescript-language-server" },
- python = { "black", "debugpy", "flake8", "isort", "jedi-language-server", "mypy", "pylint", "pyright", "python-lsp-server", "sourcery" },
+ python = { "black", "blue", "debugpy", "flake8", "isort", "jedi-language-server", "mypy", "pylint", "pyright", "python-lsp-server", "sourcery", "vulture" },
r = { "r-languageserver" },
reason = { "reason-language-server" },
rescript = { "rescript-lsp" },
@@ -99,7 +102,7 @@ return {
systemverilog = { "svlangserver", "svls", "verible" },
teal = { "teal-language-server" },
terraform = { "terraform-ls", "tflint" },
- text = { "grammarly-languageserver", "ltex-ls", "proselint", "vale" },
+ text = { "grammarly-languageserver", "ltex-ls", "proselint", "textlint", "vale" },
toml = { "taplo" },
twig = { "curlylint" },
typescript = { "chrome-debug-adapter", "deno", "eslint-lsp", "eslint_d", "firefox-debug-adapter", "node-debug2-adapter", "prettier", "prettierd", "rome", "typescript-language-server", "xo" },
@@ -110,6 +113,6 @@ return {
vue = { "prettier", "prettierd", "vetur-vls", "vue-language-server" },
wgsl = { "wgsl-analyzer" },
xml = { "lemminx" },
- yaml = { "actionlint", "prettier", "prettierd", "spectral-language-server", "yaml-language-server", "yamllint" },
+ yaml = { "actionlint", "cfn-lint", "prettier", "prettierd", "spectral-language-server", "yaml-language-server", "yamllint" },
zig = { "zls" }
} \ No newline at end of file
diff --git a/lua/mason/ui/components/main/package_list.lua b/lua/mason/ui/components/main/package_list.lua
index 830e025c..766a956e 100644
--- a/lua/mason/ui/components/main/package_list.lua
+++ b/lua/mason/ui/components/main/package_list.lua
@@ -52,7 +52,9 @@ end
local function ExpandedPackageInfo(state, pkg, is_installed)
local pkg_state = state.packages.states[pkg.name]
return Ui.CascadingStyleNode({ "INDENT" }, {
- Ui.HlTextNode(p.Comment(pkg.spec.desc)),
+ Ui.HlTextNode(_.map(function(line)
+ return { p.Comment(line) }
+ end, _.split("\n", pkg.spec.desc))),
Ui.EmptyLine(),
Ui.Table(_.concat(
_.filter(_.identity, {