aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/omnisharp/init.lua
blob: ece5ca3abc3468d95e5955b4f156558e17b61f99 (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
44
45
46
47
48
49
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local path = require "nvim-lsp-installer.path"
local Data = require "nvim-lsp-installer.data"
local std = require "nvim-lsp-installer.installers.std"
local context = require "nvim-lsp-installer.installers.context"

local coalesce, when = Data.coalesce, Data.when

return function(name, root_dir)
    return server.Server:new {
        name = name,
        root_dir = root_dir,
        homepage = "https://github.com/OmniSharp/omnisharp-roslyn",
        languages = { "csharp" },
        installer = {
            context.use_github_release_file(
                "OmniSharp/omnisharp-roslyn",
                coalesce(
                    when(platform.is_mac, "omnisharp-osx.zip"),
                    when(platform.is_linux and platform.arch == "x64", "omnisharp-linux-x64.zip"),
                    when(
                        platform.is_win,
                        coalesce(
                            when(platform.arch == "x64", "omnisharp-win-x64.zip"),
                            when(platform.arch == "arm64", "omnisharp-win-arm64.zip")
                        )
                    )
                )
            ),
            context.capture(function(ctx)
                return std.unzip_remote(ctx.github_release_file, "omnisharp")
            end),
            std.chmod("+x", { "omnisharp/run" }),
        },
        default_options = {
            cmd = {
                platform.is_win and path.concat { root_dir, "omnisharp", "OmniSharp.exe" } or path.concat {
                    root_dir,
                    "omnisharp",
                    "run",
                },
                "--languageserver",
                "--hostPID",
                tostring(vim.fn.getpid()),
            },
        },
    }
end