This commit is contained in:
Chris 2021-03-22 22:10:39 -04:00
parent 42707d1b7e
commit cd3ac0c6f8
4 changed files with 60 additions and 2 deletions

View file

@ -12,8 +12,20 @@ elseif vim.fn.has("unix") == 1 then
else else
print("Unsupported system") print("Unsupported system")
end end
local bundles = {
vim.fn.glob(
"~/.config/nvim/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
};
local on_attach = function(client, bufr)
require('jdtls').setup_dap()
require'lsp'.common_on_attach(client, bufr)
end
require('jdtls').start_or_attach({ require('jdtls').start_or_attach({
on_attach = require'lsp'.common_on_attach, on_attach = on_attach,
cmd = {JAVA_LS_EXECUTABLE}, cmd = {JAVA_LS_EXECUTABLE},
root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'}) root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
init_options = {bundles = bundles}
}) })

0
lua/nv-nvim-dap/init.lua Normal file
View file

View file

@ -25,3 +25,36 @@ command! PreviewHunk lua require 'nv-utils'.preview_hunk()
command! BlameLine lua require 'nv-utils'.blame_line() command! BlameLine lua require 'nv-utils'.blame_line()
command! W noa w command! W noa w
" Debugging
command! DebugToggleBreakpoint lua require'dap'.toggle_breakpoint()
command! DebugStart lua require'dap'.continue()
command! DebugContinue lua require'dap'.continue()
command! DebugStepOver lua require'dap'.step_over()
command! DebugStepOut lua require'dap'.step_out()
command! DebugStepInto lua require'dap'.step_into()
command! DebugToggleRepl lua require'dap'.repl.toggle()
command! DebugGetSession lua require'dap'.session()
" Available Debug Adapters:
" https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
"
" Adapter configuration and installation instructions:
" https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
"
" Debug Adapter protocol:
" https://microsoft.github.io/debug-adapter-protocol/
" TODO Add full support later
" nnoremap <silent> <F5> :lua require'dap'.continue()<CR>
" nnoremap <silent> <F10> :lua require'dap'.step_over()<CR>
" nnoremap <silent> <F11> :lua require'dap'.step_into()<CR>
" nnoremap <silent> <F12> :lua require'dap'.step_out()<CR>
" nnoremap <silent> <leader>b :lua require'dap'.toggle_breakpoint()<CR>
" nnoremap <silent> <leader>B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
" nnoremap <silent> <leader>lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
" nnoremap <silent> <leader>dr :lua require'dap'.repl.open()<CR>
" nnoremap <silent> <leader>dl :lua require'dap'.run_last()<CR>
" TODO find out why this thing follows me everywhere in java
let blacklist = ['java']
autocmd CursorHold,CursorHoldI * if index(blacklist, &ft) < 0 | lua require'nvim-lightbulb'.update_lightbulb()

View file

@ -85,6 +85,19 @@ let g:which_key_map.b = {
\ '?' : ['Buffers' , 'fzf-buffer'], \ '?' : ['Buffers' , 'fzf-buffer'],
\ } \ }
" d is for debug
let g:which_key_map.d = {
\ 'name' : '+debug' ,
\ 'b' : ['DebugToggleBreakpoint ' , 'toggle breakpoint'],
\ 'c' : ['DebugContinue' , 'continue'],
\ 'i' : ['DebugStepInto' , 'step into'],
\ 'o' : ['DebugStepOver' , 'step over'],
\ 'r' : ['DebugToggleRepl' , 'toggle repl'],
\ 's' : ['DebugStart' , 'start'],
\ }
" \ 'O' : ['DebugStepOut' , 'next-buffer'],
" \ 'S' : ['DebugGetSession ' , 'fzf-buffer'],
" F is for fold " F is for fold
let g:which_key_map.F = { let g:which_key_map.F = {