summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris <[email protected]>2021-03-22 22:10:39 -0400
committerChris <[email protected]>2021-03-22 22:10:39 -0400
commitcd3ac0c6f8881bab6de66117cbe5d23ca4a014e6 (patch)
treedde183d2e92e02e9c6497996cc8e3b69c1385a69
parent42707d1b7eaafedd4b6dbc364b826ba947045029 (diff)
nvim dap
-rw-r--r--lua/lsp/java-ls.lua16
-rw-r--r--lua/nv-nvim-dap/init.lua0
-rw-r--r--vimscript/functions.vim33
-rw-r--r--vimscript/nv-whichkey/init.vim13
4 files changed, 60 insertions, 2 deletions
diff --git a/lua/lsp/java-ls.lua b/lua/lsp/java-ls.lua
index d3dcb9d9..fd603cbb 100644
--- a/lua/lsp/java-ls.lua
+++ b/lua/lsp/java-ls.lua
@@ -12,8 +12,20 @@ elseif vim.fn.has("unix") == 1 then
else
print("Unsupported system")
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({
- on_attach = require'lsp'.common_on_attach,
+ on_attach = on_attach,
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}
})
diff --git a/lua/nv-nvim-dap/init.lua b/lua/nv-nvim-dap/init.lua
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lua/nv-nvim-dap/init.lua
diff --git a/vimscript/functions.vim b/vimscript/functions.vim
index 9a468f45..56c4526c 100644
--- a/vimscript/functions.vim
+++ b/vimscript/functions.vim
@@ -25,3 +25,36 @@ command! PreviewHunk lua require 'nv-utils'.preview_hunk()
command! BlameLine lua require 'nv-utils'.blame_line()
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()
diff --git a/vimscript/nv-whichkey/init.vim b/vimscript/nv-whichkey/init.vim
index bddbcceb..81ef410f 100644
--- a/vimscript/nv-whichkey/init.vim
+++ b/vimscript/nv-whichkey/init.vim
@@ -85,6 +85,19 @@ let g:which_key_map.b = {
\ '?' : ['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
let g:which_key_map.F = {