aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
blob: 47c28a3d2fdeb0debb81f76ac0dc2669fc35312c (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local Data = require "nvim-lsp-installer.data"
local installer = require "nvim-lsp-installer.core.installer"
local github = require "nvim-lsp-installer.core.managers.github"
local Optional = require "nvim-lsp-installer.core.optional"
local process = require "nvim-lsp-installer.process"

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/arduino/arduino-language-server",
        languages = { "arduino" },
        installer = function()
            local opts = {
                repo = "arduino/arduino-language-server",
                asset_file = function(release)
                    local target = coalesce(
                        when(platform.is_mac, "arduino-language-server_%s_macOS_64bit.tar.gz"),
                        when(
                            platform.is_linux and platform.arch == "x64",
                            "arduino-language-server_%s_Linux_64bit.tar.gz"
                        ),
                        when(
                            platform.is_linux and platform.arch == "x86",
                            "arduino-language-server_%s_Linux_32bit.tar.gz"
                        ),
                        when(
                            platform.is_linux and platform.arch == "arm64",
                            "arduino-language-server_%s_Linux_ARM64.tar.gz"
                        ),
                        when(
                            platform.is_win and platform.arch == "x64",
                            "arduino-language-server_0.6.0_Windows_64bit.zip"
                        ),
                        when(
                            platform.is_win and platform.arch == "x86",
                            "arduino-language-server_0.6.0_Windows_32bit.zip"
                        )
                    )

                    return target and target:format(release)
                end,
            }

            platform.when {
                unix = function()
                    github.untargz_release_file(opts).with_receipt()
                end,
                win = function()
                    github.unzip_release_file(opts).with_receipt()
                end,
            }
        end,
        default_options = {
            cmd_env = {
                PATH = process.extend_path { root_dir },
            },
        },
    }
end