aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-01-24 20:39:30 +0100
committerGitHub <noreply@github.com>2022-01-24 20:39:30 +0100
commite0857348087d718b7512d078bdea8568a5b4b4bc (patch)
tree226d90b3f27c2fd1ac3de5a0e7531cdef0f3547c /lua
parentadd bsl_ls (#446) (diff)
downloadmason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar.gz
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar.bz2
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar.lz
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar.xz
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.tar.zst
mason-e0857348087d718b7512d078bdea8568a5b4b4bc.zip
add crystalline (#447)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/_generated/filetype_map.lua1
-rw-r--r--lua/nvim-lsp-installer/_generated/metadata.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/crystalline/init.lua66
-rw-r--r--lua/nvim-lsp-installer/servers/init.lua1
4 files changed, 71 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/_generated/filetype_map.lua b/lua/nvim-lsp-installer/_generated/filetype_map.lua
index 5f0bef3c..3db8a2fb 100644
--- a/lua/nvim-lsp-installer/_generated/filetype_map.lua
+++ b/lua/nvim-lsp-installer/_generated/filetype_map.lua
@@ -17,6 +17,7 @@ return {
clojure = { "clojure_lsp" },
cmake = { "cmake" },
cpp = { "ccls", "clangd", "sourcekit" },
+ crystal = { "crystalline" },
cs = { "csharp_ls", "omnisharp" },
css = { "cssls", "emmet_ls", "stylelint_lsp", "tailwindcss" },
d = { "serve_d" },
diff --git a/lua/nvim-lsp-installer/_generated/metadata.lua b/lua/nvim-lsp-installer/_generated/metadata.lua
index 2f6fa9c4..79294f39 100644
--- a/lua/nvim-lsp-installer/_generated/metadata.lua
+++ b/lua/nvim-lsp-installer/_generated/metadata.lua
@@ -43,6 +43,9 @@ return {
codeqlls = {
filetypes = { "ql" }
},
+ crystalline = {
+ filetypes = { "crystal" }
+ },
csharp_ls = {
filetypes = { "cs" }
},
diff --git a/lua/nvim-lsp-installer/servers/crystalline/init.lua b/lua/nvim-lsp-installer/servers/crystalline/init.lua
new file mode 100644
index 00000000..01c8ac24
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/crystalline/init.lua
@@ -0,0 +1,66 @@
+local server = require "nvim-lsp-installer.server"
+local process = require "nvim-lsp-installer.process"
+local platform = require "nvim-lsp-installer.platform"
+local std = require "nvim-lsp-installer.installers.std"
+local context = require "nvim-lsp-installer.installers.context"
+local installers = require "nvim-lsp-installer.installers"
+local Data = require "nvim-lsp-installer.data"
+local path = require "nvim-lsp-installer.path"
+
+local coalesce, when = Data.coalesce, Data.when
+
+return function(name, root_dir)
+ return server.Server:new {
+ name = name,
+ root_dir = root_dir,
+ homepage = "https://github.com/elbywan/crystalline",
+ languages = { "crystal" },
+ installer = {
+ -- Crystalline (LSP)
+ installers.branch_context {
+ context.use_github_release_file(
+ "elbywan/crystalline",
+ coalesce(
+ when(platform.is_mac and platform.arch == "x64", "crystalline_x86_64-apple-darwin.gz"),
+ when(platform.is_linux and platform.arch == "x64", "crystalline_x86_64-unknown-linux-gnu.gz")
+ )
+ ),
+ context.capture(function(ctx)
+ return std.gunzip_remote(
+ ctx.github_release_file,
+ platform.is_win and "crystalline.exe" or "crystalline"
+ )
+ end),
+ std.chmod("+x", { "crystalline" }),
+ context.receipt(function(receipt, ctx)
+ receipt:with_primary_source(receipt.github_release_file(ctx))
+ end),
+ },
+ -- Crystal
+ installers.branch_context {
+ context.use_github_release_file("crystal-lang/crystal", function(version)
+ local target_file = coalesce(
+ when(platform.is_mac, "crystal-%s-1-darwin-universal.tar.gz"),
+ when(platform.is_linux and platform.arch == "x64", "crystal-%s-1-linux-x86_64-bundled.tar.gz")
+ )
+ return target_file and target_file:format(version)
+ end),
+ context.capture(function(ctx)
+ return installers.pipe {
+ std.untargz_remote(ctx.github_release_file),
+ std.rename(("crystal-%s-1"):format(ctx.requested_server_version), "crystal"),
+ }
+ end),
+ std.chmod("+x", { "crystalline" }),
+ context.receipt(function(receipt, ctx)
+ receipt:with_secondary_source(receipt.github_release_file(ctx))
+ end),
+ },
+ },
+ default_options = {
+ cmd_env = {
+ PATH = process.extend_path { root_dir, path.concat { root_dir, "crystal", "bin" } },
+ },
+ },
+ }
+end
diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua
index 63a83ce6..e3afd3cb 100644
--- a/lua/nvim-lsp-installer/servers/init.lua
+++ b/lua/nvim-lsp-installer/servers/init.lua
@@ -45,6 +45,7 @@ local CORE_SERVERS = Data.set_of {
"clojure_lsp",
"cmake",
"codeqlls",
+ "crystalline",
"csharp_ls",
"cssls",
"cssmodules_ls",