diff options
| author | William Boman <william@redwill.se> | 2021-09-01 10:29:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-01 10:29:23 +0200 |
| commit | bfbf5fbd39fa75847bf23da2c46d12fe2728fb78 (patch) | |
| tree | f05d2f041f895ff639684c10f57d19f1d4a433e0 /lua/nvim-lsp-installer/servers | |
| parent | README: simplify example a bit, add clarifying comment (diff) | |
| download | mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.gz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.bz2 mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.lz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.xz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.zst mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.zip | |
add Windows support (#70)
Diffstat (limited to 'lua/nvim-lsp-installer/servers')
29 files changed, 217 insertions, 160 deletions
diff --git a/lua/nvim-lsp-installer/servers/ansiblels/init.lua b/lua/nvim-lsp-installer/servers/ansiblels/init.lua index 430d55b8..b6899b70 100644 --- a/lua/nvim-lsp-installer/servers/ansiblels/init.lua +++ b/lua/nvim-lsp-installer/servers/ansiblels/init.lua @@ -1,5 +1,6 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "ansiblels" @@ -7,12 +8,14 @@ local root_dir = server.get_server_root_path "ansiblels" return server.Server:new { name = "ansiblels", root_dir = root_dir, - installer = shell.raw [[ - git clone --depth 1 https://github.com/ansible/ansible-language-server .; - npm install; - npm run build; - npm install --production; - ]], + installer = installers.when { + unix = shell.bash [[ + git clone --depth 1 https://github.com/ansible/ansible-language-server .; + npm install; + npm run build; + npm install --production; + ]], + }, default_options = { filetypes = { "yaml", "yaml.ansible" }, cmd = { "node", path.concat { root_dir, "out", "server", "src", "server.js" }, "--stdio" }, diff --git a/lua/nvim-lsp-installer/servers/clangd/init.lua b/lua/nvim-lsp-installer/servers/clangd/init.lua index f5a163f6..6028af24 100644 --- a/lua/nvim-lsp-installer/servers/clangd/init.lua +++ b/lua/nvim-lsp-installer/servers/clangd/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "c-family" return server.Server:new { name = "clangd", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, default_options = { cmd = { path.concat { root_dir, "clangd", "bin", "clangd" } }, }, diff --git a/lua/nvim-lsp-installer/servers/clangd/install.mjs b/lua/nvim-lsp-installer/servers/clangd/install.mjs index 36a7a69d..048a33c2 100644 --- a/lua/nvim-lsp-installer/servers/clangd/install.mjs +++ b/lua/nvim-lsp-installer/servers/clangd/install.mjs @@ -3,10 +3,6 @@ const VERSION = "12.0.0"; const target = (() => { const platform = os.platform(); switch (platform) { - case "win32": { - console.error(chalk.red(`${platform} is not yet supported.`)); - process.exit(1); - } case "darwin": return `clangd-mac-${VERSION}.zip`; default: diff --git a/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua b/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua index 6f54129e..8f22b676 100644 --- a/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua +++ b/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "clojure_lsp" return server.Server:new { name = "clojure_lsp", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, default_options = { cmd = { path.concat { root_dir, "clojure-lsp" } }, }, diff --git a/lua/nvim-lsp-installer/servers/clojure_lsp/install.mjs b/lua/nvim-lsp-installer/servers/clojure_lsp/install.mjs index 29cbb77b..049e983c 100644 --- a/lua/nvim-lsp-installer/servers/clojure_lsp/install.mjs +++ b/lua/nvim-lsp-installer/servers/clojure_lsp/install.mjs @@ -1,20 +1,9 @@ const VERSION = "2021.07.01-19.49.02"; -const exitNotSupported = () => { - console.error( - chalk.red(`${os.platform()} ${os.arch()} is currently not supported.`) - ); - process.exit(1); -}; - const target = (() => { switch (os.platform()) { case "darwin": return "clojure-lsp-native-macos-amd64.zip"; - case "win32": { - exitNotSupported(); - break; - } default: return "clojure-lsp-native-linux-amd64.zip"; } diff --git a/lua/nvim-lsp-installer/servers/denols/init.lua b/lua/nvim-lsp-installer/servers/denols/init.lua index 3ab7a8e2..94588564 100644 --- a/lua/nvim-lsp-installer/servers/denols/init.lua +++ b/lua/nvim-lsp-installer/servers/denols/init.lua @@ -1,5 +1,6 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "denols" @@ -7,11 +8,13 @@ local root_dir = server.get_server_root_path "denols" return server.Server:new { name = "denols", root_dir = root_dir, - installer = shell.remote("https://deno.land/x/install/install.sh", { - env = { - DENO_INSTALL = root_dir, - }, - }), + installer = installers.when { + unix = shell.remote_bash("https://deno.land/x/install/install.sh", { + env = { + DENO_INSTALL = root_dir, + }, + }), + }, default_options = { cmd = { path.concat { root_dir, "bin", "deno" }, "lsp" }, }, diff --git a/lua/nvim-lsp-installer/servers/elixirls/init.lua b/lua/nvim-lsp-installer/servers/elixirls/init.lua index 5fa5e408..d84f4f38 100644 --- a/lua/nvim-lsp-installer/servers/elixirls/init.lua +++ b/lua/nvim-lsp-installer/servers/elixirls/init.lua @@ -1,5 +1,6 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "elixir" @@ -7,12 +8,14 @@ local root_dir = server.get_server_root_path "elixir" return server.Server:new { name = "elixirls", root_dir = root_dir, - installer = shell.raw [[ - wget -O elixir-ls.zip https://github.com/elixir-lsp/elixir-ls/releases/download/v0.7.0/elixir-ls.zip; - unzip elixir-ls.zip -d elixir-ls; - rm elixir-ls.zip; - chmod +x elixir-ls/language_server.sh; - ]], + installer = installers.when { + unix = shell.bash [[ + wget -O elixir-ls.zip https://github.com/elixir-lsp/elixir-ls/releases/download/v0.7.0/elixir-ls.zip; + unzip elixir-ls.zip -d elixir-ls; + rm elixir-ls.zip; + chmod +x elixir-ls/language_server.sh; + ]], + }, default_options = { cmd = { path.concat { root_dir, "elixir-ls", "language_server.sh" } }, }, diff --git a/lua/nvim-lsp-installer/servers/eslintls/init.lua b/lua/nvim-lsp-installer/servers/eslintls/init.lua index 91f91012..1d0c874b 100644 --- a/lua/nvim-lsp-installer/servers/eslintls/init.lua +++ b/lua/nvim-lsp-installer/servers/eslintls/init.lua @@ -11,18 +11,11 @@ local ConfirmExecutionResult = { } local root_dir = server.get_server_root_path "eslint" -local install_cmd = [[ -git clone --depth 1 https://github.com/microsoft/vscode-eslint .; -npm install; -cd server; -npm install; -../node_modules/.bin/tsc; -]] return server.Server:new { name = "eslintls", root_dir = root_dir, - installer = shell.raw(install_cmd), + installer = shell.polyshell [[ git clone --depth 1 https://github.com/microsoft/vscode-eslint . && npm install && npm run compile:server ]], pre_setup = function() local lspconfig = require "lspconfig" local configs = require "lspconfig/configs" diff --git a/lua/nvim-lsp-installer/servers/groovyls/init.lua b/lua/nvim-lsp-installer/servers/groovyls/init.lua index 357992a1..f885d933 100644 --- a/lua/nvim-lsp-installer/servers/groovyls/init.lua +++ b/lua/nvim-lsp-installer/servers/groovyls/init.lua @@ -1,5 +1,6 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "groovyls" @@ -12,11 +13,11 @@ return server.Server:new { error "Missing a Javac installation." end end, - installer = shell.raw [[ - git clone --depth 1 https://github.com/GroovyLanguageServer/groovy-language-server .; - ./gradlew build; - ]], + installer = installers.when { + unix = shell.bash [[ git clone --depth 1 https://github.com/GroovyLanguageServer/groovy-language-server . && ./gradlew build ]], + win = shell.cmd [[ git clone --depth 1 https://github.com/GroovyLanguageServer/groovy-language-server . && .\gradlew build ]], + }, default_options = { - cmd = { "java", "-jar", path.concat { root_dir, "groovy-language-server-all.jar" } }, + cmd = { "java", "-jar", path.concat { root_dir, "build", "libs", "groovyls-all.jar" } }, }, } diff --git a/lua/nvim-lsp-installer/servers/hls/init.lua b/lua/nvim-lsp-installer/servers/hls/init.lua index b19d4a39..2ce227f9 100644 --- a/lua/nvim-lsp-installer/servers/hls/init.lua +++ b/lua/nvim-lsp-installer/servers/hls/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "haskell" return server.Server:new { name = "hls", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, default_options = { cmd = { path.concat { root_dir, "hls" } }, }, diff --git a/lua/nvim-lsp-installer/servers/hls/install.mjs b/lua/nvim-lsp-installer/servers/hls/install.mjs index d711fdec..c9460e7c 100644 --- a/lua/nvim-lsp-installer/servers/hls/install.mjs +++ b/lua/nvim-lsp-installer/servers/hls/install.mjs @@ -3,10 +3,6 @@ const VERSION = "1.3.0"; const target = (() => { const platform = os.platform(); switch (platform) { - case "win32": { - console.error(chalk.red(`${platform} is not yet supported.`)); - process.exit(1); - } case "darwin": return `haskell-language-server-macOS-${VERSION}.tar.gz`; default: 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 8aaf77de..b402fa8e 100644 --- a/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua +++ b/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua @@ -1,5 +1,7 @@ local server = require "nvim-lsp-installer.server" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" +local platform = require "nvim-lsp-installer.platform" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "kotlin" @@ -7,12 +9,22 @@ local root_dir = server.get_server_root_path "kotlin" return server.Server:new { name = "kotlin_language_server", root_dir = root_dir, - installer = shell.raw [[ - wget -O server.zip https://github.com/fwcd/kotlin-language-server/releases/latest/download/server.zip; - unzip server.zip; - rm server.zip; - ]], + installer = installers.when { + unix = shell.bash [[ + wget -O server.zip https://github.com/fwcd/kotlin-language-server/releases/latest/download/server.zip; + unzip server.zip; + rm server.zip; + ]], + win = shell.cmd [[ curl -fLo server.zip https://github.com/fwcd/kotlin-language-server/releases/latest/download/server.zip && tar -xvf server.zip && del /f server.zip ]], + }, default_options = { - cmd = { path.concat { root_dir, "server", "bin", "kotlin-language-server" } }, + cmd = { + path.concat { + root_dir, + "server", + "bin", + platform.is_win() and "kotlin-language-server.bat" or "kotlin-language-server", + }, + }, }, } diff --git a/lua/nvim-lsp-installer/servers/omnisharp/common.mjs b/lua/nvim-lsp-installer/servers/omnisharp/common.mjs new file mode 100644 index 00000000..cd41b089 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/omnisharp/common.mjs @@ -0,0 +1,35 @@ +const VERSION = "v1.37.11"; + +const exitNotSupported = () => { + console.error(chalk.red(`${os.platform()} ${os.arch()} is currently not supported.`)); + process.exit(1); +}; + +export const getDownloadUrl = () => { + const target = (() => { + switch (os.platform()) { + case "darwin": + return "omnisharp-osx.zip"; + case "win32": + switch (os.arch()) { + case "arm64": + return "omnisharp-win-arm64.zip"; + case "x64": + return "omnisharp-win-x64.zip"; + default: + return exitNotSupported(); + } + default: + switch (os.arch()) { + case "arm64": + return exitNotSupported(); + case "x64": + return "omnisharp-linux-x64.zip"; + default: + return exitNotSupported(); + } + } + })(); + + return `https://github.com/OmniSharp/omnisharp-roslyn/releases/download/${VERSION}/${target}`; +}; diff --git a/lua/nvim-lsp-installer/servers/omnisharp/init.lua b/lua/nvim-lsp-installer/servers/omnisharp/init.lua index 5b108a58..b9bafa50 100644 --- a/lua/nvim-lsp-installer/servers/omnisharp/init.lua +++ b/lua/nvim-lsp-installer/servers/omnisharp/init.lua @@ -1,4 +1,6 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" +local platform = require "nvim-lsp-installer.platform" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,10 +9,14 @@ local root_dir = server.get_server_root_path "omnisharp" return server.Server:new { name = "omnisharp", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + win = zx.file "./install.win.mjs", + }, default_options = { cmd = { - path.concat { root_dir, "omnisharp", "run" }, + platform.is_win() and path.concat { root_dir, "OmniSharp.exe" } + or path.concat { root_dir, "omnisharp", "run" }, "--languageserver", "--hostPID", tostring(vim.fn.getpid()), diff --git a/lua/nvim-lsp-installer/servers/omnisharp/install.mjs b/lua/nvim-lsp-installer/servers/omnisharp/install.mjs index eba881f0..14d705b3 100644 --- a/lua/nvim-lsp-installer/servers/omnisharp/install.mjs +++ b/lua/nvim-lsp-installer/servers/omnisharp/install.mjs @@ -1,28 +1,6 @@ -const VERSION = "v1.37.11"; +import { getDownloadUrl } from "./common.mjs"; -const exitNotSupported = () => { - console.error( - chalk.red(`${os.platform()} ${os.arch()} is currently not supported.`) - ); - process.exit(1); -}; - -const target = (() => { - switch (os.platform()) { - case "win32": { - exitNotSupported(); - break; - } - case "darwin": - return "omnisharp-osx.zip"; - default: - return "omnisharp-linux-x64.zip"; - } -})(); - -const downloadUrl = `https://github.com/OmniSharp/omnisharp-roslyn/releases/download/${VERSION}/${target}`; - -await $`wget -O omnisharp.zip ${downloadUrl}`; +await $`wget -O omnisharp.zip ${getDownloadUrl()}`; await $`unzip omnisharp.zip -d omnisharp`; await $`chmod +x omnisharp/run`; await $`rm omnisharp.zip`; diff --git a/lua/nvim-lsp-installer/servers/omnisharp/install.win.mjs b/lua/nvim-lsp-installer/servers/omnisharp/install.win.mjs new file mode 100644 index 00000000..286c60f5 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/omnisharp/install.win.mjs @@ -0,0 +1,10 @@ +import { getDownloadUrl } from "./common.mjs"; + +// TODO: can this be... less hacky? +$.shell = "powershell.exe"; +$.prefix = ""; +$.quote = (a) => a; + +await $`wget -O omnisharp.zip ${getDownloadUrl()}`; +await $`tar -xvf omnisharp.zip`; +await $`rm omnisharp.zip`; diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/common.mjs b/lua/nvim-lsp-installer/servers/rust_analyzer/common.mjs new file mode 100644 index 00000000..0f54a71e --- /dev/null +++ b/lua/nvim-lsp-installer/servers/rust_analyzer/common.mjs @@ -0,0 +1,41 @@ +export const VERSION = "2021-06-28"; + +const exitNotSupported = () => { + console.error(chalk.red(`${os.platform()} ${os.arch()} is currently not supported.`)); + process.exit(1); +}; + +export const getDownloadUrl = () => { + const target = (() => { + switch (os.platform()) { + case "win32": { + switch (os.arch()) { + case "arm64": + return "rust-analyzer-aarch64-pc-windows-msvc.gz"; + case "x64": + return "rust-analyzer-x86_64-pc-windows-msvc.gz"; + default: + return exitNotSupported(); + } + } + case "darwin": + switch (os.arch()) { + case "arm64": + return "rust-analyzer-aarch64-apple-darwin.gz"; + case "x64": + return "rust-analyzer-x86_64-apple-darwin.gz"; + default: + return exitNotSupported(); + } + default: + switch (os.arch()) { + case "arm64": + return "rust-analyzer-aarch64-unknown-linux-gnu.gz"; + default: + return "rust-analyzer-x86_64-unknown-linux-gnu.gz"; + } + } + })(); + + return `https://github.com/rust-analyzer/rust-analyzer/releases/download/${VERSION}/${target}`; +}; diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua index 6502ee07..58cb53e2 100644 --- a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua +++ b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,10 @@ local root_dir = server.get_server_root_path "rust" return server.Server:new { name = "rust_analyzer", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + win = zx.file "./install.win.mjs", + }, default_options = { cmd = { path.concat { root_dir, "rust-analyzer" } }, }, diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/install.mjs b/lua/nvim-lsp-installer/servers/rust_analyzer/install.mjs index 7e976850..4d3fec85 100644 --- a/lua/nvim-lsp-installer/servers/rust_analyzer/install.mjs +++ b/lua/nvim-lsp-installer/servers/rust_analyzer/install.mjs @@ -1,41 +1,5 @@ -const VERSION = "2021-06-28"; +import { getDownloadUrl } from "./common.mjs"; -const exitNotSupported = () => { - console.error( - chalk.red(`${os.platform()} ${os.arch()} is currently not supported.`) - ); - process.exit(1); -}; - -const target = (() => { - switch (os.platform()) { - case "win32": { - exitNotSupported(); - break; - } - case "darwin": - switch (os.arch()) { - case "arm64": - return "rust-analyzer-aarch64-apple-darwin.gz"; - case "x64": - return "rust-analyzer-x86_64-apple-darwin.gz"; - default: { - exitNotSupported(); - break; - } - } - default: - switch (os.arch()) { - case "arm64": - return "rust-analyzer-aarch64-unknown-linux-gnu.gz"; - default: - return "rust-analyzer-x86_64-unknown-linux-gnu.gz"; - } - } -})(); - -const downloadUrl = `https://github.com/rust-analyzer/rust-analyzer/releases/download/${VERSION}/${target}`; - -await $`wget -O rust-analyzer.gz ${downloadUrl}`; -await $`gunzip rust-analyzer.gz`; +await $`wget -O rust-analyzer.gz ${getDownloadUrl()}`; +await $`gzip -fd rust-analyzer.gz`; await $`chmod +x rust-analyzer`; diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/install.win.mjs b/lua/nvim-lsp-installer/servers/rust_analyzer/install.win.mjs new file mode 100644 index 00000000..22ad75f7 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/rust_analyzer/install.win.mjs @@ -0,0 +1,9 @@ +import { getDownloadUrl } from "./common.mjs"; + +// TODO: can this be... less hacky? +$.shell = "powershell.exe"; +$.prefix = ""; +$.quote = (a) => a; + +await $`wget -O rust-analyzer.exe.gz ${getDownloadUrl()}`; +await $`gzip -fd rust-analyzer.exe.gz`; diff --git a/lua/nvim-lsp-installer/servers/solargraph/init.lua b/lua/nvim-lsp-installer/servers/solargraph/init.lua index fdad4861..d23b029e 100644 --- a/lua/nvim-lsp-installer/servers/solargraph/init.lua +++ b/lua/nvim-lsp-installer/servers/solargraph/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "ruby" return server.Server:new { name = "solargraph", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, pre_install_check = function() if vim.fn.executable "bundle" ~= 1 then error "bundle not installed" diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua index bda3718c..7ad00ebe 100644 --- a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua +++ b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -13,7 +14,9 @@ local bin_dir = uname_alias[uname] or uname return server.Server:new { name = "sumneko_lua", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, pre_install_check = function() if vim.fn.executable "ninja" ~= 1 then error "ninja not installed (see https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages)" diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs b/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs index 0673e6f2..3f2d20e0 100644 --- a/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs +++ b/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs @@ -3,18 +3,14 @@ await $`git submodule update --init --recursive`; cd("3rd/luamake"); switch (os.platform()) { - case "darwin": { - await $`ninja -f compile/ninja/macos.ninja`; - break; - } - case "win32": { - console.error(chalk.red("Windows is currently not supported.")); - process.exit(1); - } - default: { - await $`ninja -f compile/ninja/linux.ninja`; - break; - } + case "darwin": { + await $`ninja -f compile/ninja/macos.ninja`; + break; + } + default: { + await $`ninja -f compile/ninja/linux.ninja`; + break; + } } cd("."); diff --git a/lua/nvim-lsp-installer/servers/tailwindcss/init.lua b/lua/nvim-lsp-installer/servers/tailwindcss/init.lua index e4056771..cf76d0b0 100644 --- a/lua/nvim-lsp-installer/servers/tailwindcss/init.lua +++ b/lua/nvim-lsp-installer/servers/tailwindcss/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "tailwindcss" return server.Server:new { name = "tailwindcss", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, default_options = { cmd = { "node", diff --git a/lua/nvim-lsp-installer/servers/terraformls/init.lua b/lua/nvim-lsp-installer/servers/terraformls/init.lua index 1fce1669..5df3cecc 100644 --- a/lua/nvim-lsp-installer/servers/terraformls/init.lua +++ b/lua/nvim-lsp-installer/servers/terraformls/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "terraform" return server.Server:new { name = "terraformls", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, default_options = { cmd = { path.concat { root_dir, "terraform-ls", "terraform-ls" }, "serve" }, }, diff --git a/lua/nvim-lsp-installer/servers/terraformls/install.mjs b/lua/nvim-lsp-installer/servers/terraformls/install.mjs index 7e642757..04efc288 100644 --- a/lua/nvim-lsp-installer/servers/terraformls/install.mjs +++ b/lua/nvim-lsp-installer/servers/terraformls/install.mjs @@ -7,10 +7,6 @@ const exitNotSupported = () => { const target = (() => { switch (os.platform()) { - case "win32": { - exitNotSupported(); - break; - } case "darwin": switch (os.arch()) { case "arm64": diff --git a/lua/nvim-lsp-installer/servers/texlab/init.lua b/lua/nvim-lsp-installer/servers/texlab/init.lua index 2e3eeea3..c669806b 100644 --- a/lua/nvim-lsp-installer/servers/texlab/init.lua +++ b/lua/nvim-lsp-installer/servers/texlab/init.lua @@ -1,4 +1,5 @@ local server = require "nvim-lsp-installer.server" +local installers = require "nvim-lsp-installer.installers" local path = require "nvim-lsp-installer.path" local zx = require "nvim-lsp-installer.installers.zx" @@ -7,7 +8,9 @@ local root_dir = server.get_server_root_path "latex" return server.Server:new { name = "texlab", root_dir = root_dir, - installer = zx.file "./install.mjs", + installer = installers.when { + unix = zx.file "./install.mjs", + }, pre_install_check = function() if vim.fn.executable "wget" ~= 1 then error "Missing wget. Please, refer to https://www.gnu.org/software/wget/ to install it." diff --git a/lua/nvim-lsp-installer/servers/texlab/install.mjs b/lua/nvim-lsp-installer/servers/texlab/install.mjs index dbf77e11..bc7fefe1 100644 --- a/lua/nvim-lsp-installer/servers/texlab/install.mjs +++ b/lua/nvim-lsp-installer/servers/texlab/install.mjs @@ -1,4 +1,4 @@ -const VERSION = "v3.2.0" +const VERSION = "v3.2.0"; const platform = os.platform(); @@ -6,16 +6,11 @@ const target = (() => { switch (platform) { case "darwin": return `https://github.com/latex-lsp/texlab/releases/download/${VERSION}/texlab-x86_64-macos.tar.gz`; - case "win32": { - console.error(chalk.red("Windows is currently not supported.")); - process.exit(1); - break; - } default: return `https://github.com/latex-lsp/texlab/releases/download/${VERSION}/texlab-x86_64-linux.tar.gz`; } })(); -await $`wget -O texlab.tar.gz ${target}` -await $`tar xf texlab.tar.gz` -await $`rm texlab.tar.gz` +await $`wget -O texlab.tar.gz ${target}`; +await $`tar xf texlab.tar.gz`; +await $`rm texlab.tar.gz`; diff --git a/lua/nvim-lsp-installer/servers/tflint/init.lua b/lua/nvim-lsp-installer/servers/tflint/init.lua index 396f1cf9..51de105e 100644 --- a/lua/nvim-lsp-installer/servers/tflint/init.lua +++ b/lua/nvim-lsp-installer/servers/tflint/init.lua @@ -1,6 +1,7 @@ local server = require "nvim-lsp-installer.server" local notify = require "nvim-lsp-installer.notify" local path = require "nvim-lsp-installer.path" +local installers = require "nvim-lsp-installer.installers" local shell = require "nvim-lsp-installer.installers.shell" local root_dir = server.get_server_root_path "tflint" @@ -10,12 +11,14 @@ local bin_path = path.concat { root_dir, "tflint" } return server.Server:new { name = "tflint", root_dir = root_dir, - installer = shell.remote("https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh", { - env = { - TFLINT_INSTALL_PATH = root_dir, - TFLINT_INSTALL_NO_ROOT = 1, - }, - }), + 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" }, }, |
