aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/omnisharp/init.lua
blob: 4bb2a7ec7b265cbadcfaf58a4fd1b3750b187a75 (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
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 root_dir = server.get_server_root_path "omnisharp"

local VERSION = "v1.37.15"

local target = Data.coalesce(
    Data.when(platform.is_mac, "omnisharp-osx.zip"),
    Data.when(platform.is_unix and platform.arch == "x64", "omnisharp-linux-x64.zip"),
    Data.when(
        platform.is_win,
        Data.coalesce(
            Data.when(platform.arch == "x64", "omnisharp-win-x64.zip"),
            Data.when(platform.arch == "arm64", "omnisharp-win-arm64.zip")
        )
    )
)

return server.Server:new {
    name = "omnisharp",
    root_dir = root_dir,
    installer = {
        std.unzip_remote(
            ("https://github.com/OmniSharp/omnisharp-roslyn/releases/download/%s/%s"):format(VERSION, target),
            "omnisharp"
        ),
        std.chmod("+x", { "omnisharp/run" }),
    },
    default_options = {
        cmd = {
            platform.is_win and path.concat { root_dir, "OmniSharp.exe" }
                or path.concat { root_dir, "omnisharp", "run" },
            "--languageserver",
            "--hostPID",
            tostring(vim.fn.getpid()),
        },
    },
}