forked from nvim-java/nvim-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlspconfig-setup-wrap.lua
More file actions
48 lines (35 loc) · 1.13 KB
/
lspconfig-setup-wrap.lua
File metadata and controls
48 lines (35 loc) · 1.13 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
local log = require('java.utils.log')
local mason_util = require('java-core.utils.mason')
local server = require('java-core.ls.servers.jdtls')
local M = {}
---comment
---@param config java.Config
function M.setup(config)
log.info('wrap lspconfig.java.setup function to inject a custom java config')
vim.api.nvim_exec_autocmds('User', { pattern = 'JavaJdtlsSetup' })
local jdtls_plugins = {}
if config.java_test.enable then
table.insert(jdtls_plugins, 'java-test')
end
if config.java_debug_adapter.enable then
table.insert(jdtls_plugins, 'java-debug-adapter')
end
if config.spring_boot_tools.enable then
table.insert(jdtls_plugins, 'spring-boot-tools')
end
local default_config = server.get_config({
root_markers = config.root_markers,
jdtls_plugins = jdtls_plugins,
use_mason_jdk = config.jdk.auto_install,
})
if config.spring_boot_tools.enable then
require('spring_boot').setup({
ls_path = mason_util.get_pkg_path('spring-boot-tools')
.. '/extension/language-server',
})
require('spring_boot').init_lsp_commands()
end
-- Use new Neovim 0.11 LSP API
vim.lsp.config('jdtls', default_config)
end
return M