aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/ansiblels/init.lua
blob: ca2933e6f4588a9e5eced5c871a0a5b86c596714 (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
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local std = require "nvim-lsp-installer.installers.std"
local npm = require "nvim-lsp-installer.installers.npm"
local context = require "nvim-lsp-installer.installers.context"

return function(name, root_dir)
    return server.Server:new {
        name = name,
        root_dir = root_dir,
        languages = { "ansible" },
        homepage = "https://github.com/ansible/ansible-language-server",
        installer = {
            std.git_clone "https://github.com/ansible/ansible-language-server",
            npm.install { "npm@latest" }, -- ansiblels has quite a strict npm version requirement
            npm.exec("npm", { "install" }),
            npm.run "compile",
            context.receipt(function(receipt)
                receipt:with_primary_source(receipt.git_remote "https://github.com/ansible/ansible-language-server")
            end),
        },
        default_options = {
            cmd = { "node", path.concat { root_dir, "out", "server", "src", "server.js" }, "--stdio" },
        },
    }
end