-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathinit.lua
More file actions
33 lines (31 loc) · 922 Bytes
/
init.lua
File metadata and controls
33 lines (31 loc) · 922 Bytes
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
local M = {}
local env = {
VSCODE_EXTENSIONS = vim.env["VSCODE_EXTENSIONS"],
LOMBOK_ENABLE = vim.env["LOMBOK_ENABLE"] or "Y",
}
M.get_vscode_extensions = function()
return env.VSCODE_EXTENSIONS or "~/.vscode/extensions"
end
M.find_one = function(extension_path)
local v = vim.fn.glob(M.get_vscode_extensions() .. extension_path)
if v and v ~= "" then
if type(v) == "string" then
local pt = vim.split(v, "\n")
return pt[#pt]
elseif type(v) == "table" then
return v[1]
end
return v
end
end
M.get_lombok_jar = function()
local lombok_jar = nil
if env.LOMBOK_ENABLE == "Y" then
lombok_jar = M.find_one("/redhat.java-*/lombok/lombok-*.jar")
if lombok_jar == nil and require("mason-registry").has_package("jdtls") then
lombok_jar = require("mason-registry").get_package("jdtls"):get_install_path() .. "/lombok.jar"
end
end
return lombok_jar
end
return M