Skip to content

Commit

Permalink
feat(registry): add latexindent formatter (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwoodside authored Jan 27, 2023
1 parent e9c49c7 commit dc48fae
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/mason-registry/index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ return {
["kotlin-debug-adapter"] = "mason-registry.kotlin-debug-adapter",
["kotlin-language-server"] = "mason-registry.kotlin-language-server",
ktlint = "mason-registry.ktlint",
latexindent = "mason-registry.latexindent",
lelwel = "mason-registry.lelwel",
lemminx = "mason-registry.lemminx",
["lemmy-help"] = "mason-registry.lemmy-help",
Expand Down
36 changes: 36 additions & 0 deletions lua/mason-registry/latexindent/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local Pkg = require "mason-core.package"
local github = require "mason-core.managers.github"
local platform = require "mason-core.platform"
local std = require "mason-core.managers.std"
local _ = require "mason-core.functional"

local coalesce, when = _.coalesce, _.when

return Pkg.new {
name = "latexindent",
desc = _.dedent [[
latexindent.pl is a perl script to beautify/tidy/format/indent (add horizontal leading space to) code within
environments, commands, after headings and within special code blocks.
]],
homepage = "https://github.com/cmhughes/latexindent.pl",
languages = { Pkg.Lang.LaTeX },
categories = { Pkg.Cat.Formatter },
---@async
---@param ctx InstallContext
install = function(ctx)
github
.download_release_file({
repo = "cmhughes/latexindent.pl",
out_file = platform.is.win and "latexindent.exe" or "latexindent",
asset_file = coalesce(
when(platform.is.mac_x64, "latexindent-macos"),
when(platform.is.mac_arm64, "latexindent-macos"),
when(platform.is.linux_x64_gnu, "latexindent-linux"),
when(platform.is.win_x64, "latexindent.exe")
),
})
.with_receipt()
std.chmod("+x", { "latexindent" })
ctx:link_bin("latexindent", platform.is.win and "latexindent.exe" or "latexindent")
end,
}
2 changes: 1 addition & 1 deletion lua/mason/mappings/language.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ return {
julia = { "julia-lsp" },
kotlin = { "kotlin-debug-adapter", "kotlin-language-server", "ktlint" },
ksh = { "beautysh" },
latex = { "ltex-ls", "tectonic", "texlab", "vale" },
latex = { "latexindent", "ltex-ls", "tectonic", "texlab", "vale" },
lelwel = { "lelwel" },
less = { "css-lsp", "prettier", "prettierd" },
liquid = { "curlylint", "shopify-theme-check" },
Expand Down

0 comments on commit dc48fae

Please sign in to comment.