-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathjava.lua
More file actions
109 lines (87 loc) · 3.99 KB
/
java.lua
File metadata and controls
109 lines (87 loc) · 3.99 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
local runner_api = require('java.api.runner')
local settings_api = require('java.api.settings')
local profile_ui = require('java.ui.profile')
local M = {}
---@param custom_config java.PartialConfig | nil
function M.setup(custom_config)
local default_conf = require('java.config')
local test_api = require('java-test')
local config = vim.tbl_deep_extend('force', default_conf, custom_config or {})
vim.g.nvim_java_config = config
----------------------------------------------------------------------
-- checks --
----------------------------------------------------------------------
require('java.checks').run(config)
----------------------------------------------------------------------
-- logger setup --
----------------------------------------------------------------------
if config.log then
require('java-core.utils.log2').setup(config.log --[[@as java-core.PartialLog2Config]])
end
----------------------------------------------------------------------
-- package installation --
----------------------------------------------------------------------
local Manager = require('pkgm.manager')
local pkgm = Manager()
pkgm:install('jdtls', config.jdtls.version)
if config.java_test.enable then
----------------------------------------------------------------------
-- test --
----------------------------------------------------------------------
pkgm:install('java-test', config.java_test.version)
M.test = {
run_current_class = test_api.run_current_class,
debug_current_class = test_api.debug_current_class,
run_current_method = test_api.run_current_method,
debug_current_method = test_api.debug_current_method,
view_last_report = test_api.view_last_report,
}
end
if config.java_debug_adapter.enable then
----------------------------------------------------------------------
-- debugger --
----------------------------------------------------------------------
pkgm:install('java-debug', config.java_debug_adapter.version)
require('java-dap').setup()
M.dap = {
config_dap = function()
require('java-dap').config_dap()
end,
}
end
if config.spring_boot_tools.enable then
pkgm:install('spring-boot-tools', config.spring_boot_tools.version)
end
if config.lombok.enable then
pkgm:install('lombok', config.lombok.version)
end
if config.jdk.auto_install then
pkgm:install('openjdk', config.jdk.version)
end
----------------------------------------------------------------------
-- init --
----------------------------------------------------------------------
require('java.startup.lsp_setup').setup(config)
require('java.startup.decompile-watcher').setup()
require('java-refactor').setup()
end
----------------------------------------------------------------------
-- Runner APIs --
----------------------------------------------------------------------
M.runner = {}
M.runner.built_in = {}
M.runner.built_in.run_app = runner_api.built_in.run_app
M.runner.built_in.toggle_logs = runner_api.built_in.toggle_logs
M.runner.built_in.stop_app = runner_api.built_in.stop_app
M.runner.built_in.switch_app = runner_api.built_in.switch_app
----------------------------------------------------------------------
-- Profile UI --
----------------------------------------------------------------------
M.profile = {}
M.profile.ui = profile_ui.ui
----------------------------------------------------------------------
-- Settings --
----------------------------------------------------------------------
M.settings = {}
M.settings.change_runtime = settings_api.change_runtime
return M