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 Data = require "nvim-lsp-installer.data"
local a = require "nvim-lsp-installer.core.async"
local platform = require "nvim-lsp-installer.platform"
local github = require "nvim-lsp-installer.core.managers.github"
local spawn = require "nvim-lsp-installer.core.spawn"
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,
languages = { "terraform" },
homepage = "https://github.com/terraform-linters/tflint",
async = true,
installer = function()
github.unzip_release_file({
repo = "terraform-linters/tflint",
asset_file = coalesce(
when(platform.is_mac and platform.arch == "x64", "tflint_darwin_amd64.zip"),
when(platform.is_mac and platform.arch == "arm64", "tflint_darwin_arm64.zip"),
when(platform.is_linux and platform.arch == "x64", "tflint_linux_amd64.zip"),
when(platform.is_linux and platform.arch == "arm64", "tflint_linux_arm64.zip"),
when(platform.is_linux and platform.arch == "x86", "tflint_linux_386.zip"),
when(platform.is_win and platform.arch == "x64", "tflint_windows_amd64.zip")
),
}).with_receipt()
end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
},
commands = {
TFLintInit = {
a.scope(function()
local notify = require "nvim-lsp-installer.notify"
notify "Installing TFLint plugins…"
spawn.tflint({
"--init",
cwd = vim.loop.getcwd(),
with_paths = { root_dir },
})
:on_success(function()
if vim.in_fast_event() then
a.scheduler()
end
notify "Successfully installed TFLint plugins."
end)
:on_failure(function()
if vim.in_fast_event() then
a.scheduler()
end
notify "Failed to install TFLint plugins."
end)
end),
description = "Runs tflint --init in the current working directory.",
},
},
},
}
end
|