aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/serve_d/init.lua
blob: 477dd65c157c9e03778ca603a5b13e62fe9f7593 (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
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local path = require "nvim-lsp-installer.path"
local std = require "nvim-lsp-installer.installers.std"
local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"

return function(name, root_dir)
    return server.Server:new {
        name = name,
        root_dir = root_dir,
        homepage = "https://github.com/Pure-D/serve-d",
        languages = { "d" },
        installer = {
            context.set(function(ctx)
                -- Consider the latest (as of writing) beta release as "latest", instead of 0.6.0.
                -- This is because 1) 0.6.0 is really old, but mostly 2) there are inconcistencies in which assets are
                -- available 0.6.0 vs 0.7.0 beta releases.
                ctx.requested_server_version = Data.coalesce(ctx.requested_server_version, "v0.7.0-beta.7")
            end),
            context.use_github_release_file("Pure-D/serve-d", function(version)
                return Data.coalesce(
                    Data.when(platform.is_mac, "serve-d_%s-osx-x86_64.tar.xz"),
                    Data.when(platform.is_linux, "serve-d_%s-linux-x86_64.tar.xz"),
                    Data.when(platform.is_win, "serve-d_%s-windows-x86_64.zip")
                ):format(version:gsub("^v", ""))
            end),
            context.capture(function(ctx)
                if platform.is_win then
                    return std.unzip_remote(ctx.github_release_file)
                else
                    return std.untarxz_remote(ctx.github_release_file)
                end
            end),
        },
        default_options = {
            cmd = { path.concat { root_dir, "serve-d" } },
        },
    }
end