diff options
| author | William Boman <william@redwill.se> | 2021-09-07 03:19:12 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2021-09-07 03:26:46 +0200 |
| commit | edf900163bf4ba1581b5350799a3ba4424a38006 (patch) | |
| tree | deb771f4318217ae07d0944d31e22a7a0621011d /lua | |
| parent | add direct integration with libuv instead of going through termopen, also imp... (diff) | |
| download | mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar.gz mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar.bz2 mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar.lz mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar.xz mason-edf900163bf4ba1581b5350799a3ba4424a38006.tar.zst mason-edf900163bf4ba1581b5350799a3ba4424a38006.zip | |
some fixes
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/init.lua | 4 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/installers/npm.lua | 4 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/installers/pip3.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/installers/shell.lua | 10 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/installers/zx.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/platform.lua | 9 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/process.lua | 6 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/omnisharp/init.lua | 2 |
9 files changed, 21 insertions, 20 deletions
diff --git a/lua/nvim-lsp-installer/installers/init.lua b/lua/nvim-lsp-installer/installers/init.lua index 991c773e..98bb78bc 100644 --- a/lua/nvim-lsp-installer/installers/init.lua +++ b/lua/nvim-lsp-installer/installers/init.lua @@ -35,14 +35,14 @@ end function M.when(platform_table) return function(server, callback, context) - if platform.is_unix() then + if platform.is_unix then if platform_table.unix then platform_table.unix(server, callback, context) else context.stdio_sink.stderr(("Unix is not yet supported for server %q."):format(server.name)) callback(false) end - elseif platform.is_win() then + elseif platform.is_win then if platform_table.win then platform_table.win(server, callback, context) else diff --git a/lua/nvim-lsp-installer/installers/npm.lua b/lua/nvim-lsp-installer/installers/npm.lua index d3c8167f..93bbb5ae 100644 --- a/lua/nvim-lsp-installer/installers/npm.lua +++ b/lua/nvim-lsp-installer/installers/npm.lua @@ -6,7 +6,7 @@ local M = {} function M.packages(packages) return function(server, callback, context) - process.spawn(platform.is_win() and "npm.cmd" or "npm", { + process.spawn(platform.is_win and "npm.cmd" or "npm", { args = vim.list_extend({ "install" }, packages), cwd = server.root_dir, stdio_sink = context.stdio_sink, @@ -19,7 +19,7 @@ function M.executable(root_dir, executable) root_dir, "node_modules", ".bin", - platform.is_win() and ("%s.cmd"):format(executable) or executable, + platform.is_win and ("%s.cmd"):format(executable) or executable, } end diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua index 5aefe372..277e0321 100644 --- a/lua/nvim-lsp-installer/installers/pip3.lua +++ b/lua/nvim-lsp-installer/installers/pip3.lua @@ -21,7 +21,7 @@ function M.packages(packages) end function M.executable(root_dir, executable) - return path.concat { root_dir, REL_INSTALL_DIR, platform.is_win() and "Scripts" or "bin", executable } + return path.concat { root_dir, REL_INSTALL_DIR, platform.is_win and "Scripts" or "bin", executable } end return M diff --git a/lua/nvim-lsp-installer/installers/shell.lua b/lua/nvim-lsp-installer/installers/shell.lua index 37b5e03f..2ba84305 100644 --- a/lua/nvim-lsp-installer/installers/shell.lua +++ b/lua/nvim-lsp-installer/installers/shell.lua @@ -11,11 +11,13 @@ local function shell(opts) env = process.graft_env(opts.env or {}), }, callback) - local stdin = stdio[1] + if stdio then + local stdin = stdio[1] - stdin:write(opts.cmd) - stdin:write "\n" - stdin:close() + stdin:write(opts.cmd) + stdin:write "\n" + stdin:close() + end end end diff --git a/lua/nvim-lsp-installer/installers/zx.lua b/lua/nvim-lsp-installer/installers/zx.lua index 9b24e1af..7bebdc33 100644 --- a/lua/nvim-lsp-installer/installers/zx.lua +++ b/lua/nvim-lsp-installer/installers/zx.lua @@ -36,7 +36,7 @@ local function zx_installer(force) fs.mkdirp(INSTALL_DIR) -- todo use process installer - local handle, pid = process.spawn(platform.is_win() and "npm.cmd" or "npm", { + local handle, pid = process.spawn(platform.is_win and "npm.cmd" or "npm", { args = { npm_command, "zx@1" }, cwd = INSTALL_DIR, stdio_sink = opts.stdio_sink, diff --git a/lua/nvim-lsp-installer/platform.lua b/lua/nvim-lsp-installer/platform.lua index 0b327cf2..7a30bf47 100644 --- a/lua/nvim-lsp-installer/platform.lua +++ b/lua/nvim-lsp-installer/platform.lua @@ -1,11 +1,6 @@ local M = {} -function M.is_win() - return vim.fn.has "win32" == 1 -end - -function M.is_unix() - return vim.fn.has "unix" == 1 -end +M.is_win = vim.fn.has "win32" == 1 +M.is_unix = vim.fn.has "unix" == 1 return M diff --git a/lua/nvim-lsp-installer/process.lua b/lua/nvim-lsp-installer/process.lua index 61097a88..5195f06a 100644 --- a/lua/nvim-lsp-installer/process.lua +++ b/lua/nvim-lsp-installer/process.lua @@ -20,9 +20,13 @@ local function connect_sink(pipe, sink) end end +-- We gather the root env immediately, primarily because of E5560. +-- Also, there's no particular reason we need to refresh the environment (yet). +local environ = vim.fn.environ() + function M.graft_env(env) local root_env = {} - for key, val in pairs(vim.fn.environ()) do + for key, val in pairs(environ) do root_env[#root_env + 1] = key .. "=" .. val end for key, val in pairs(env) do diff --git a/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua b/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua index b402fa8e..7b4a481d 100644 --- a/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua +++ b/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua @@ -23,7 +23,7 @@ return server.Server:new { root_dir, "server", "bin", - platform.is_win() and "kotlin-language-server.bat" or "kotlin-language-server", + platform.is_win and "kotlin-language-server.bat" or "kotlin-language-server", }, }, }, diff --git a/lua/nvim-lsp-installer/servers/omnisharp/init.lua b/lua/nvim-lsp-installer/servers/omnisharp/init.lua index b9bafa50..825ba811 100644 --- a/lua/nvim-lsp-installer/servers/omnisharp/init.lua +++ b/lua/nvim-lsp-installer/servers/omnisharp/init.lua @@ -15,7 +15,7 @@ return server.Server:new { }, default_options = { cmd = { - platform.is_win() and path.concat { root_dir, "OmniSharp.exe" } + platform.is_win and path.concat { root_dir, "OmniSharp.exe" } or path.concat { root_dir, "omnisharp", "run" }, "--languageserver", "--hostPID", |
