diff options
Diffstat (limited to 'lua/nvim-lsp-installer/installers/zx.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/zx.lua | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lua/nvim-lsp-installer/installers/zx.lua b/lua/nvim-lsp-installer/installers/zx.lua index 1fae81c0..5308ac66 100644 --- a/lua/nvim-lsp-installer/installers/zx.lua +++ b/lua/nvim-lsp-installer/installers/zx.lua @@ -1,15 +1,15 @@ -local fs = require("nvim-lsp-installer.fs") -local path = require("nvim-lsp-installer.path") -local notify = require("nvim-lsp-installer.notify") -local installers = require("nvim-lsp-installer.installers") -local shell = require("nvim-lsp-installer.installers.shell") -local npm = require("nvim-lsp-installer.installers.npm") +local fs = require "nvim-lsp-installer.fs" +local path = require "nvim-lsp-installer.path" +local notify = require "nvim-lsp-installer.notify" +local installers = require "nvim-lsp-installer.installers" +local shell = require "nvim-lsp-installer.installers.shell" +local npm = require "nvim-lsp-installer.installers.npm" local uv = vim.loop local M = {} -local INSTALL_DIR = path.concat { vim.fn.stdpath("data"), "lsp_servers", ".zx" } +local INSTALL_DIR = path.concat { vim.fn.stdpath "data", "lsp_servers", ".zx" } local ZX_EXECUTABLE = npm.executable(INSTALL_DIR, "zx") local has_installed_zx = false @@ -17,13 +17,13 @@ local has_installed_zx = false local function zx_installer(force) force = force or false -- be careful with boolean logic if flipping this - return function (_, callback) + return function(_, callback) if has_installed_zx and not force then callback(true, "zx already installed") return end - if vim.fn.executable("npm") ~= 1 or vim.fn.executable("node") ~= 1 then + if vim.fn.executable "npm" ~= 1 or vim.fn.executable "node" ~= 1 then callback(false, "Cannot install zx because npm and/or node not installed.") return end @@ -43,7 +43,7 @@ local function zx_installer(force) args = { npm_command, "zx@1" }, cwd = INSTALL_DIR, }, - vim.schedule_wrap(function (code) + vim.schedule_wrap(function(code) if code ~= 0 then callback(false, "Failed to install zx.") return @@ -59,11 +59,8 @@ end function M.file(relpath) local script_path = path.realpath(relpath, 3) return installers.compose { - shell.raw(("%q %q"):format( - ZX_EXECUTABLE, - script_path - )), - zx_installer(false) + shell.raw(("%q %q"):format(ZX_EXECUTABLE, script_path)), + zx_installer(false), } end |
