aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/clients/eclipse.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/mason-core/clients/eclipse.lua')
-rw-r--r--lua/mason-core/clients/eclipse.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/mason-core/clients/eclipse.lua b/lua/mason-core/clients/eclipse.lua
new file mode 100644
index 00000000..bca31648
--- /dev/null
+++ b/lua/mason-core/clients/eclipse.lua
@@ -0,0 +1,15 @@
+local fetch = require "mason-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
+
+---@async
+function M.fetch_latest_jdtls_version()
+ return fetch("https://download.eclipse.org/jdtls/snapshots/latest.txt"):map(M._parse_jdtls_version_string)
+end
+
+return M