Added jdtls config
This commit is contained in:
parent
d751aeb332
commit
d1a6798981
|
|
@ -0,0 +1,26 @@
|
||||||
|
-- print 'Loaded ftplugin/java.lua'
|
||||||
|
local jdtls = require 'jdtls'
|
||||||
|
|
||||||
|
local root_dir = require('jdtls.setup').find_root { '.git', 'mvnw', 'gradlew', 'pom.xml' }
|
||||||
|
if root_dir == '' then
|
||||||
|
root_dir = vim.fn.getcwd()
|
||||||
|
end
|
||||||
|
|
||||||
|
print('JDTLS root_dir = ' .. root_dir)
|
||||||
|
|
||||||
|
local workspace_dir = vim.fn.stdpath 'data' .. '/jdtls-workspace/' .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
cmd = { vim.fn.stdpath 'data' .. '/mason/packages/jdtls/bin/jdtls' }, -- 👈 absolute path
|
||||||
|
root_dir = root_dir,
|
||||||
|
workspace_folder = workspace_dir,
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
project = {
|
||||||
|
sourcePaths = { 'src' }, -- 👈 tells jdtls where sources begin
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
jdtls.start_or_attach(config)
|
||||||
6
init.lua
6
init.lua
|
|
@ -816,6 +816,10 @@ require('lazy').setup({
|
||||||
--- @type blink.cmp.Config
|
--- @type blink.cmp.Config
|
||||||
opts = {
|
opts = {
|
||||||
keymap = {
|
keymap = {
|
||||||
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
|
-- Manually trigger a completion from nvim-cmp.
|
||||||
|
-- Generally you don't need this, because nvim-cmp will display
|
||||||
|
-- completions whenever it has completion options available.
|
||||||
-- 'default' (recommended) for mappings similar to built-in completions
|
-- 'default' (recommended) for mappings similar to built-in completions
|
||||||
-- <c-y> to accept ([y]es) the completion.
|
-- <c-y> to accept ([y]es) the completion.
|
||||||
-- This will auto-import if your LSP supports it.
|
-- This will auto-import if your LSP supports it.
|
||||||
|
|
@ -838,7 +842,7 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
preset = 'default',
|
preset = 'default',
|
||||||
|
['<Enter>'] = { 'select_and_accept', 'fallback' },
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue