aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/texlab/init.lua
blob: df2b2b54e95d8d06659f850e38056d6dc90777e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
local Pkg = require "mason-core.package"
local _ = require "mason-core.functional"
local github = require "mason-core.managers.github"
local platform = require "mason-core.platform"

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

return Pkg.new {
    name = "texlab",
    desc = [[An implementation of the Language Server Protocol for LaTeX]],
    homepage = "https://github.com/latex-lsp/texlab",
    categories = { Pkg.Cat.LSP },
    languages = { Pkg.Lang.LaTeX },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        local repo = "latex-lsp/texlab"
        platform.when {
            unix = function()
                github
                    .untargz_release_file({
                        repo = repo,
                        asset_file = coalesce(
                            when(platform.is.mac_arm64, "texlab-aarch64-macos.tar.gz"),
                            when(platform.is.mac_x64, "texlab-x86_64-macos.tar.gz"),
                            when(platform.is.linux_x64, "texlab-x86_64-linux.tar.gz")
                        ),
                    })
                    .with_receipt()
                ctx:link_bin("texlab", "texlab")
            end,
            win = function()
                github
                    .unzip_release_file({
                        repo = repo,
                        asset_file = coalesce(when(platform.arch == "x64", "texlab-x86_64-windows.zip")),
                    })
                    .with_receipt()
                ctx:link_bin("texlab", "texlab.exe")
            end,
        }
    end,
}