mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2025-06-25 14:48:33 +02:00
done maybe
This commit is contained in:
parent
d00f77555e
commit
c54b71fdd4
24 changed files with 2632 additions and 501 deletions
52
lua/custom/plugins/jdtls_config.lua
Normal file
52
lua/custom/plugins/jdtls_config.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
--[[
|
||||
JDTLS Configuration
|
||||
|
||||
This file configures the Java Development Tools Language Server (jdtls)
|
||||
to fix deprecation warnings and JVM restrictions.
|
||||
]]
|
||||
|
||||
return {
|
||||
-- Override the default jdtls setup
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
-- Configure jdtls with the necessary JVM arguments to fix warnings
|
||||
setup = {
|
||||
jdtls = function(_, opts)
|
||||
-- Get existing Java arguments or initialize an empty table
|
||||
local java_args = opts.cmd or {}
|
||||
|
||||
-- Add the necessary JVM arguments to fix the deprecation warnings
|
||||
local fixed_java_args = {
|
||||
-- Enable unrestricted access to JDK internal API
|
||||
"--enable-native-access=ALL-UNNAMED",
|
||||
-- Explicitly allow these modules to eliminate warnings
|
||||
"--add-modules=jdk.incubator.vector",
|
||||
-- Suppress deprecation warnings
|
||||
"-Dsun.misc.Unsafe.allowDeprecation=true",
|
||||
}
|
||||
|
||||
-- Find the java command index in the cmd array
|
||||
local java_cmd_index = 1
|
||||
for i, arg in ipairs(java_args) do
|
||||
if arg:match("java$") then
|
||||
java_cmd_index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- Insert our arguments after the java command
|
||||
for i, arg in ipairs(fixed_java_args) do
|
||||
table.insert(java_args, java_cmd_index + i, arg)
|
||||
end
|
||||
|
||||
-- Update the command
|
||||
opts.cmd = java_args
|
||||
|
||||
-- Return false to let the default handler continue
|
||||
return false
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue