-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontext.lua
More file actions
33 lines (30 loc) · 793 Bytes
/
context.lua
File metadata and controls
33 lines (30 loc) · 793 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 utils = require("java-deps.utils")
local config = require("java-deps.config")
local M = {
current_client = nil,
root_dir = nil,
root_uri = nil,
}
M.current_config = function()
if M.root_dir == nil then
M.attach(utils.get_client(config.jdtls_name))
end
return M
end
M.attach = function(client, _, root_dir)
if client == nil then
vim.notify(config.jdtls_name .. " client not found", vim.log.levels.ERROR)
return
end
M.current_client = client
M.root_dir = root_dir or client.config.root_dir
M.root_uri = "file://" .. M.root_dir
if M.current_config().root_dir == nil then
vim.notify(config.jdtls_name .. " client root_dir is empty", vim.log.levels.ERROR)
end
end
M.clear = function()
M.current_client = nil
M.client_configs = {}
end
return M