aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/clients/eclipse.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/core/clients/eclipse.lua')
-rw-r--r--lua/nvim-lsp-installer/core/clients/eclipse.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/core/clients/eclipse.lua b/lua/nvim-lsp-installer/core/clients/eclipse.lua
new file mode 100644
index 00000000..a788f2e2
--- /dev/null
+++ b/lua/nvim-lsp-installer/core/clients/eclipse.lua
@@ -0,0 +1,21 @@
+local fetch = require "nvim-lsp-installer.core.fetch"
+local M = {}
+
+---@param version string The version string as found in the latest.txt endpoint.
+---@return string The parsed version number.
+function M._parse_jdtls_version_string(version)
+ return vim.trim(version):gsub("^jdt%-language%-server%-", ""):gsub("%.tar%.gz$", "")
+end
+
+---@param callback fun(err: string|nil, data: string|nil)
+function M.fetch_latest_jdtls_version(callback)
+ fetch("https://download.eclipse.org/jdtls/snapshots/latest.txt", function(err, data)
+ if err then
+ callback(err, nil)
+ else
+ callback(nil, M._parse_jdtls_version_string(data))
+ end
+ end)
+end
+
+return M