aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-06-03 19:04:52 +0200
committerGitHub <noreply@github.com>2022-06-03 19:04:52 +0200
commitf5f6538984b5bc9bccfc544960e05d47304f3c5e (patch)
tree9f1f0fcd3b35a7ace0efc9966b652bb9b8234121 /lua/nvim-lsp-installer/servers
parentadded wgsl_analyzer server (#719) (diff)
downloadmason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.gz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.bz2
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.lz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.xz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.zst
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.zip
feat: add apex_ls (#746)
Closes #701.
Diffstat (limited to 'lua/nvim-lsp-installer/servers')
-rw-r--r--lua/nvim-lsp-installer/servers/apex_ls/init.lua44
-rw-r--r--lua/nvim-lsp-installer/servers/init.lua1
2 files changed, 45 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/servers/apex_ls/init.lua b/lua/nvim-lsp-installer/servers/apex_ls/init.lua
new file mode 100644
index 00000000..56585b78
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/apex_ls/init.lua
@@ -0,0 +1,44 @@
+local server = require "nvim-lsp-installer.server"
+local github = require "nvim-lsp-installer.core.managers.github"
+local github_client = require "nvim-lsp-installer.core.managers.github.client"
+local git = require "nvim-lsp-installer.core.managers.git"
+local Optional = require "nvim-lsp-installer.core.optional"
+local path = require "nvim-lsp-installer.core.path"
+local _ = require "nvim-lsp-installer.core.functional"
+
+return function(name, root_dir)
+ local JAR_FILE = "apex-jorje-lsp.jar"
+
+ return server.Server:new {
+ name = name,
+ root_dir = root_dir,
+ homepage = "https://github.com/forcedotcom/salesforcedx-vscode",
+ languages = { "apex" },
+ ---@async
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local repo = "forcedotcom/salesforcedx-vscode"
+
+ -- See https://github.com/forcedotcom/salesforcedx-vscode/issues/4184#issuecomment-1146052086
+ ---@type GitHubRelease
+ local release = github_client
+ .fetch_releases(repo)
+ :map(_.find_first(_.prop_satisfies(_.compose(_.gt(0), _.length), "assets")))
+ :map(Optional.of_nilable)
+ :get_or_throw() -- Result unwrap
+ :or_else_throw "Failed to find release with assets." -- Optional unwrap
+
+ github.unzip_release_file({
+ version = Optional.of(release.tag_name),
+ asset_file = _.compose(_.format "salesforcedx-vscode-apex-%s.vsix", _.gsub("^v", "")),
+ repo = repo,
+ }).with_receipt()
+
+ ctx.fs:rename(path.concat { "extension", "out", JAR_FILE }, JAR_FILE)
+ ctx.fs:rmrf "extension"
+ end,
+ default_options = {
+ apex_jar_path = path.concat { root_dir, JAR_FILE },
+ },
+ }
+end
diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua
index fc049589..861f4e09 100644
--- a/lua/nvim-lsp-installer/servers/init.lua
+++ b/lua/nvim-lsp-installer/servers/init.lua
@@ -34,6 +34,7 @@ local INSTALL_DIRS = {
local CORE_SERVERS = _.set_of {
"angularls",
"ansiblels",
+ "apex_ls",
"arduino_language_server",
"asm_lsp",
"astro",