aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/elixirls/init.lua
blob: 006c02220153a491874611cc84880c7023c8e4af (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 server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local platform = require "nvim-lsp-installer.platform"
local github = require "nvim-lsp-installer.core.managers.github"
local std = require "nvim-lsp-installer.core.managers.std"

return function(name, root_dir)
    return server.Server:new {
        name = name,
        root_dir = root_dir,
        homepage = "https://github.com/elixir-lsp/elixir-ls",
        languages = { "elixir" },
        async = true,
        ---@param ctx InstallContext
        installer = function(ctx)
            -- We write to the elixir-ls directory for backwards compatibility reasons
            ctx.fs:mkdir "elixir-ls"
            ctx:chdir("elixir-ls", function()
                github.unzip_release_file({
                    repo = "elixir-lsp/elixir-ls",
                    asset_file = "elixir-ls.zip",
                }).with_receipt()
                std.chmod("+x", { "language_server.sh" })
            end)
        end,
        default_options = {
            cmd = {
                path.concat {
                    root_dir,
                    "elixir-ls",
                    platform.is_win and "language_server.bat" or "language_server.sh",
                },
            },
        },
    }
end