aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/rescript-lsp/init.lua
blob: ec79ab0971921144712565f45b316043eac4036c (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
local Pkg = require "mason-core.package"
local github = require "mason-core.managers.github"
local path = require "mason-core.path"

return Pkg.new {
    name = "rescript-lsp",
    desc = [[Language Server for ReScript.]],
    homepage = "https://github.com/rescript-lang/rescript-vscode",
    languages = { Pkg.Lang.ReScript },
    categories = { Pkg.Cat.LSP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        github
            .unzip_release_file({
                repo = "rescript-lang/rescript-vscode",
                asset_file = function(version)
                    return ("rescript-vscode-%s.vsix"):format(version)
                end,
            })
            .with_receipt()

        ctx:link_bin(
            "rescript-lsp",
            ctx:write_node_exec_wrapper(
                "rescript-lsp",
                path.concat {
                    "extension",
                    "server",
                    "out",
                    "server.js",
                }
            )
        )
    end,
}