aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/fsautocomplete/init.lua
blob: a14a72868880e6afda5dad00aa24adb9cca43854 (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 process = require "nvim-lsp-installer.process"
local std = require "nvim-lsp-installer.installers.std"

return function(name, root_dir)
    return server.Server:new {
        name = name,
        root_dir = root_dir,
        languages = { "f#" },
        homepage = "https://github.com/fsharp/FsAutoComplete",
        installer = {
            std.ensure_executables {
                {
                    "dotnet",
                    "dotnet was not found in path. Refer to https://dotnet.microsoft.com/download for installation instructions.",
                },
            },
            ---@type ServerInstallerFunction
            function(_, callback, ctx)
                process.spawn("dotnet", {
                    args = { "tool", "update", "--tool-path", ".", "fsautocomplete" },
                    cwd = ctx.install_dir,
                    stdio_sink = ctx.stdio_sink,
                }, function(success)
                    if not success then
                        ctx.stdio_sink.stderr "Failed to install fsautocomplete.\n"
                        callback(false)
                    else
                        callback(true)
                    end
                end)
            end,
        },
        default_options = {
            cmd_env = {
                PATH = process.extend_path { root_dir },
            },
        },
    }
end