-
-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathinit.lua
More file actions
42 lines (34 loc) · 1.03 KB
/
init.lua
File metadata and controls
42 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
local class = require('java-core.utils.class')
local BaseSpec = require('pkgm.specs.base-spec')
local version_map = require('pkgm.specs.jdtls-spec.version-map')
local err = require('java-core.utils.errors')
---@class pkgm.JdtlsSpec: pkgm.BaseSpec
local JdtlsSpec = class(BaseSpec)
function JdtlsSpec:_init(config)
---@diagnostic disable-next-line: undefined-field
self:super(config)
end
function JdtlsSpec:get_url(name, version)
---@diagnostic disable-next-line: undefined-field
local url = self._base.get_url(self, name, version)
if not version_map[version] then
local message = string.format(
[[
%s@%s is not defined in the version map.
You can update the version map yourself and create a PR.
nvim-java/lua/pkgm/specs/jdtls-spec/version-map.lua
or
Please create an issue at:
https://github.com/s1n7ax/nvim-java/issues to add the missing version.
]],
name,
version
)
err.throw(message)
end
local new_url = self:parse_template(url, {
timestamp = version_map[version],
})
return new_url
end
return JdtlsSpec