aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-10-05 20:23:29 +0200
committerGitHub <noreply@github.com>2021-10-05 20:23:29 +0200
commit8e2f53359adbca5797785d3d4a4021b3db4a0dff (patch)
treeb1a6ff2969ea96a7747628b9d5b44bfe7918cbbb /lua
parentREADME: fix available lsp list (diff)
downloadmason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar.gz
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar.bz2
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar.lz
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar.xz
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.tar.zst
mason-8e2f53359adbca5797785d3d4a4021b3db4a0dff.zip
add serve_d (#133)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/installers/std.lua19
-rw-r--r--lua/nvim-lsp-installer/servers/init.lua1
-rw-r--r--lua/nvim-lsp-installer/servers/serve_d/init.lua38
3 files changed, 53 insertions, 5 deletions
diff --git a/lua/nvim-lsp-installer/installers/std.lua b/lua/nvim-lsp-installer/installers/std.lua
index 35c9ab21..bd1f7f61 100644
--- a/lua/nvim-lsp-installer/installers/std.lua
+++ b/lua/nvim-lsp-installer/installers/std.lua
@@ -52,11 +52,14 @@ function M.unzip_remote(url, dest)
}
end
-function M.untar(file)
+function M.untar(file, opts)
+ opts = opts or {
+ strip_components = 0,
+ }
return installers.pipe {
function(server, callback, context)
process.spawn("tar", {
- args = { "-xvf", file },
+ args = { "-xvf", file, "--strip-components", opts.strip_components },
cwd = server.root_dir,
stdio_sink = context.stdio_sink,
}, callback)
@@ -65,11 +68,17 @@ function M.untar(file)
}
end
-function M.untargz_remote(url)
+function M.untarxz_remote(url, tar_opts)
+ return installers.pipe {
+ M.download_file(url, "archive.tar.xz"),
+ M.untar("archive.tar.xz", tar_opts),
+ }
+end
+
+function M.untargz_remote(url, tar_opts)
return installers.pipe {
M.download_file(url, "archive.tar.gz"),
- M.gunzip "archive.tar.gz",
- M.untar "archive.tar",
+ M.untar("archive.tar", tar_opts),
}
end
diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua
index b7f497a2..fbae3c47 100644
--- a/lua/nvim-lsp-installer/servers/init.lua
+++ b/lua/nvim-lsp-installer/servers/init.lua
@@ -79,6 +79,7 @@ local CORE_SERVERS = Data.set_of {
"rescriptls",
"rome",
"rust_analyzer",
+ "serve_d",
"solargraph",
"sqlls",
"sqls",
diff --git a/lua/nvim-lsp-installer/servers/serve_d/init.lua b/lua/nvim-lsp-installer/servers/serve_d/init.lua
new file mode 100644
index 00000000..719d9d5f
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/serve_d/init.lua
@@ -0,0 +1,38 @@
+local server = require "nvim-lsp-installer.server"
+local platform = require "nvim-lsp-installer.platform"
+local path = require "nvim-lsp-installer.path"
+local std = require "nvim-lsp-installer.installers.std"
+local context = require "nvim-lsp-installer.installers.context"
+local Data = require "nvim-lsp-installer.data"
+
+return function(name, root_dir)
+ return server.Server:new {
+ name = name,
+ root_dir = root_dir,
+ installer = {
+ context.set(function(ctx)
+ -- Consider the latest (as of writing) beta release as "latest", instead of 0.6.0.
+ -- This is because 1) 0.6.0 is really old, but mostly 2) there are inconcistencies in which assets are
+ -- available 0.6.0 vs 0.7.0 beta releases.
+ ctx.requested_server_version = Data.coalesce(ctx.requested_server_version, "v0.7.0-beta.7")
+ end),
+ context.github_release_file("Pure-D/serve-d", function(version)
+ return Data.coalesce(
+ Data.when(platform.is_mac, "serve-d_%s-osx-x86_64.tar.xz"),
+ Data.when(platform.is_linux, "serve-d_%s-linux-x86_64.tar.xz"),
+ Data.when(platform.is_win, "serve-d_%s-windows-x86_64.zip")
+ ):format(version:gsub("^v", ""))
+ end),
+ context.capture(function(ctx)
+ if platform.is_win then
+ return std.unzip_remote(ctx.github_release_file)
+ else
+ return std.untarxz_remote(ctx.github_release_file)
+ end
+ end),
+ },
+ default_options = {
+ cmd = { path.concat { root_dir, "serve-d" } },
+ },
+ }
+end