aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/tflint/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/servers/tflint/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/tflint/init.lua79
1 files changed, 41 insertions, 38 deletions
diff --git a/lua/nvim-lsp-installer/servers/tflint/init.lua b/lua/nvim-lsp-installer/servers/tflint/init.lua
index 289f68dc..d4cb74c3 100644
--- a/lua/nvim-lsp-installer/servers/tflint/init.lua
+++ b/lua/nvim-lsp-installer/servers/tflint/init.lua
@@ -5,44 +5,47 @@ local installers = require "nvim-lsp-installer.installers"
local shell = require "nvim-lsp-installer.installers.shell"
local process = require "nvim-lsp-installer.process"
-local root_dir = server.get_server_root_path "tflint"
+return function(name, root_dir)
+ local bin_path = path.concat { root_dir, "tflint" }
-local bin_path = path.concat { root_dir, "tflint" }
-
-return server.Server:new {
- name = "tflint",
- root_dir = root_dir,
- installer = installers.when {
- unix = shell.remote_bash("https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh", {
- env = {
- TFLINT_INSTALL_PATH = root_dir,
- TFLINT_INSTALL_NO_ROOT = 1,
- },
- }),
- },
- default_options = {
- cmd = { bin_path, "--langserver" },
- },
- post_setup = function()
- function _G.lsp_installer_tflint_init()
- notify "Installing TFLint plugins…"
- process.spawn(
- bin_path,
+ return server.Server:new {
+ name = name,
+ root_dir = root_dir,
+ installer = installers.when {
+ unix = shell.remote_bash(
+ "https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh",
{
- args = { "--init" },
- cwd = path.cwd(),
- stdio_sink = process.simple_sink(),
- },
- vim.schedule_wrap(function(success)
- if success then
- notify "Successfully installed TFLint plugins."
- else
- notify "Failed to install TFLint."
- end
- end)
- )
- end
+ env = {
+ TFLINT_INSTALL_PATH = root_dir,
+ TFLINT_INSTALL_NO_ROOT = 1,
+ },
+ }
+ ),
+ },
+ default_options = {
+ cmd = { bin_path, "--langserver" },
+ },
+ post_setup = function()
+ function _G.lsp_installer_tflint_init()
+ notify "Installing TFLint plugins…"
+ process.spawn(
+ bin_path,
+ {
+ args = { "--init" },
+ cwd = path.cwd(),
+ stdio_sink = process.simple_sink(),
+ },
+ vim.schedule_wrap(function(success)
+ if success then
+ notify "Successfully installed TFLint plugins."
+ else
+ notify "Failed to install TFLint."
+ end
+ end)
+ )
+ end
- vim.cmd [[ command! TFLintInit call v:lua.lsp_installer_tflint_init() ]]
- end,
-}
+ vim.cmd [[ command! TFLintInit call v:lua.lsp_installer_tflint_init() ]]
+ end,
+ }
+end