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

return Pkg.new {
    name = "bicep-lsp",
    desc = [[Bicep is a declarative language for describing and deploying Azure resources]],
    homepage = "https://github.com/Azure/bicep",
    languages = { Pkg.Lang.Bicep },
    categories = { Pkg.Cat.LSP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        std.ensure_executable("dotnet", { help_url = "https://dotnet.microsoft.com/download" })
        ctx.fs:mkdir "vscode"
        ctx:chdir("vscode", function()
            -- The bicep-langserver.zip is a bit broken on POSIX systems - so we download it via the VSCode distribution
            -- instead. See https://github.com/Azure/bicep/issues/3704.
            github
                .unzip_release_file({
                    repo = "Azure/bicep",
                    asset_file = "vscode-bicep.vsix",
                })
                .with_receipt()
        end)
        ctx.fs:rename(path.concat { "vscode", "extension", "bicepLanguageServer" }, "langserver")
        ctx.fs:rmrf "vscode"
        ctx:chdir "langserver"
    end,
}