mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix: java lombok support
when shell config JDTLS_JVM_ARGS environment , auto config agrs
This commit is contained in:
parent
879e29504d
commit
e3c1924d9f
1 changed files with 16 additions and 0 deletions
|
|
@ -17,6 +17,10 @@ local function extend_or_override(config, custom, ...)
|
||||||
return config
|
return config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local env = {
|
||||||
|
JDTLS_JVM_ARGS = os.getenv("JDTLS_JVM_ARGS"),
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Add java to treesitter.
|
-- Add java to treesitter.
|
||||||
{
|
{
|
||||||
|
|
@ -75,6 +79,17 @@ return {
|
||||||
return root_dir and vim.fs.basename(root_dir)
|
return root_dir and vim.fs.basename(root_dir)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-- get shell JDTLS_JVM_ARGS environment see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#java_language_server
|
||||||
|
get_jdtls_jvm_args = function()
|
||||||
|
local args = {}
|
||||||
|
for a in string.gmatch((env.JDTLS_JVM_ARGS or ""), "%S+") do
|
||||||
|
local arg = string.format("--jvm-arg=%s", a)
|
||||||
|
table.insert(args, arg)
|
||||||
|
end
|
||||||
|
return unpack(args)
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
-- Where are the config and workspace dirs for a project?
|
-- Where are the config and workspace dirs for a project?
|
||||||
jdtls_config_dir = function(project_name)
|
jdtls_config_dir = function(project_name)
|
||||||
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
|
||||||
|
|
@ -97,6 +112,7 @@ return {
|
||||||
opts.jdtls_config_dir(project_name),
|
opts.jdtls_config_dir(project_name),
|
||||||
"-data",
|
"-data",
|
||||||
opts.jdtls_workspace_dir(project_name),
|
opts.jdtls_workspace_dir(project_name),
|
||||||
|
opts.get_jdtls_jvm_args(),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
return cmd
|
return cmd
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue