Skip to content

Commit

Permalink
dap and java integration updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gerlach committed Feb 1, 2023
1 parent 3c346ca commit ccc9e42
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
16 changes: 8 additions & 8 deletions lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
"leap.nvim": { "branch": "main", "commit": "ff4c3663e5a0a0ecbb3fffbc8318825def35d2aa" },
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "53f3a8bdcb77d4a95b082fd57e12173f353c6c3e" },
"mason.nvim": { "branch": "main", "commit": "2469bfc2538652cb0cf88c129f67d38e46a9cb59" },
"mason.nvim": { "branch": "main", "commit": "46400632ed629add5f56faf7b8748c656ff88602" },
"mini.ai": { "branch": "main", "commit": "270d5b8eb61e4aeede7a8591fdc72db824b0cfd7" },
"mini.comment": { "branch": "main", "commit": "137cf43aaaed41c733a8e0087fab6ee08bb45293" },
"mini.indentscope": { "branch": "main", "commit": "3a517f11aa9d1434c4cdba1a807df4e5ca42d3ea" },
"mini.pairs": { "branch": "main", "commit": "ead264c5fd846c06752b6f3e0edb1d806c888cf9" },
"mini.surround": { "branch": "main", "commit": "194e3a1c550b2b90019d42b40e029bf6455f374b" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
"neoconf.nvim": { "branch": "main", "commit": "4ab0362ba0b6394d0587fd05952f3f9436611129" },
"neoconf.nvim": { "branch": "main", "commit": "9fb68ebc1b5632b2e3e93ddb5ad1985c75c59fbd" },
"neodev.nvim": { "branch": "main", "commit": "8fd21037453f4306f500e437c5cbdf6e8b6c2f99" },
"noice.nvim": { "branch": "main", "commit": "34f7cf628666c6eb0c93fbe8a0490e977ac78b7b" },
"nui.nvim": { "branch": "main", "commit": "b99e6cb13dc51768abc1c4c8585045a0c0459ef1" },
"null-ls.nvim": { "branch": "main", "commit": "7b2b28e207a1df4ebb13c7dc0bd83f69b5403d71" },
"null-ls.nvim": { "branch": "main", "commit": "c3e678110d5f31854c6575cf4bda3b82f3d4a884" },
"nvim-cmp": { "branch": "main", "commit": "e7e2ef7031db8e0cfad7ad9916ec766ddd9dbb3b" },
"nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" },
Expand All @@ -47,8 +47,8 @@
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
"nvim-scrollview": { "branch": "main", "commit": "c0699da2f00976943d39c7b32c015c768f68e74b" },
"nvim-spectre": { "branch": "master", "commit": "24275beae382e6bd0180b3064cf5729548641a02" },
"nvim-treesitter": { "branch": "master", "commit": "f6531e27fdce207ce6c47bf9ff82a485b3b63823" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9011d333aa411ae71ca8762ca3a277ce6b9e6527" },
"nvim-treesitter": { "branch": "master", "commit": "4cc201ecd9840562ed8822af607966e3303df228" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "249d90a84df63f3ffff65fcc06a45d58415672de" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-web-devicons": { "branch": "master", "commit": "a421d183ef37dfa13f51a5805bed2381aebf9080" },
"package-info.nvim": { "branch": "master", "commit": "54337910c67946ffb8a2845a4e547dba925e0f37" },
Expand All @@ -67,9 +67,9 @@
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
"trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" },
"typescript.nvim": { "branch": "main", "commit": "f66d4472606cb24615dfb7dbc6557e779d177624" },
"vim-illuminate": { "branch": "master", "commit": "4e1d43cdc39e35f495c7b39a78a349b4d5badad0" },
"vim-illuminate": { "branch": "master", "commit": "d6ca7f77eeaf61b3e6ce9f0e5a978d606df44298" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-startuptime": { "branch": "master", "commit": "cb4c112b9e0f224236ee4eab6bf5153406b3f88b" },
"vim-startuptime": { "branch": "master", "commit": "c7021c332e615a9ef6f50381dbf9f04bec6245aa" },
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" },
"zen-mode.nvim": { "branch": "main", "commit": "2c8f9f3758a4c430ff867e547741424ac16208bb" }
"zen-mode.nvim": { "branch": "main", "commit": "136dda65769cee45119f16e4bc3d3f13a7aecb28" }
}
3 changes: 3 additions & 0 deletions lua/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ if vim.fn.executable("btop") == 1 then
-- btop
vim.keymap.set("n", "<leader>xb", function() require("lazyvim.util").float_term({ "btop" }) end, { desc = "btop" })
end

vim.keymap.set("n", "<leader>xl", "<cmd>Trouble loclist<cr>", { desc = "Open Location List (Trouble)" })
vim.keymap.set("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", { desc = "Open Quickfix List (Trouble)" })
36 changes: 17 additions & 19 deletions lua/plugins/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,28 @@ return {
})
end,
keys = {
{ "<leader>dbc", "<CMD>lua require(\"dap\").set_breakpoint(vim.ui.input(\"Breakpoint condition: \"))<CR>",
desc = "conditional breakpoint" },
{ "<leader>dbl", "<CMD>lua require(\"dap\").set_breakpoint(nil, nil, vim.ui.input(\"Log point message: \"))<CR>",
desc = "logpoint" },
{ "<leader>dbr", "<CMD>lua require(\"dap.breakpoints\").clear()<CR>", desc = "remove all" },
{ "<leader>dbc", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, desc = "conditional breakpoint" },
{ "<leader>dbl", function() require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message")) end, desc = "logpoint" },
{ "<leader>dbr", function() require("dap.breakpoints").clear() end, desc = "remove all" },
{ "<leader>dbs", "<CMD>Telescope dap list_breakpoints<CR>", desc = "show all" },
{ "<leader>dbt", "<CMD>lua require(\"dap\").toggle_breakpoint()<CR>", desc = "toggle breakpoint" },
{ "<leader>dc", "<CMD>lua require(\"dap\").continue()<CR>", desc = "continue" },
{ "<leader>de", "<CMD>lua require(\"dap.ui.widgets\").hover(nil, { border = \"none\" })<CR>", desc = "expression", mode = { "n", "v" } },
{ "<leader>dp", "<CMD>lua require(\"dap\").pause()<CR>", desc = "pause" },
{ "<leader>dbt", function() require("dap").toggle_breakpoint() end, desc = "toggle breakpoint" },
{ "<leader>dc", function() require("dap").continue() end, desc = "continue" },
{ "<leader>de", function() require("dap.ui.widgets").hover(nil, { border = "none" }) end, desc = "expression", mode = { "n", "v" } },
{ "<leader>dp", function() require("dap").pause() end, desc = "pause" },
{ "<leader>dr", "<CMD>Telescope dap configurations<CR>", desc = "run" },
{ "<leader>dsb", "<CMD>lua require(\"dap\").step_back()<CR>", desc = "step back" },
{ "<leader>dsc", "<CMD>lua require(\"dap\").run_to_cursor()<CR>", desc = "step to cursor" },
{ "<leader>dsi", "<CMD>lua require(\"dap\").step_into()<CR>", desc = "step into" },
{ "<leader>dso", "<CMD>lua require(\"dap\").step_over()<CR>", desc = "step over" },
{ "<leader>dsx", "<CMD>lua require(\"dap\").step_out()<CR>", desc = "step out" },
{ "<leader>dx", "<CMD>lua require(\"dap\").terminate()<CR>", desc = "terminate" },
{ "<leader>dvf", "<CMD>lua require(\"dap.ui.widgets\").centered_float(require(\"dap.ui.widgets\").frames, { border = \"none\" })<CR>",
{ "<leader>dsb", function() require("dap").step_back() end, desc = "step back" },
{ "<leader>dsc", function() require("dap").run_to_cursor() end, desc = "step to cursor" },
{ "<leader>dsi", function() require("dap").step_into() end, desc = "step into" },
{ "<leader>dso", function() require("dap").step_over() end, desc = "step over" },
{ "<leader>dsx", function() require("dap").step_out() end, desc = "step out" },
{ "<leader>dx", function() require("dap").terminate() end, desc = "terminate" },
{ "<leader>dvf", function() require("dap.ui.widgets").centered_float(require("dap.ui.widgets").frames, { border = "none" }) end,
desc = "show frames" },
{ "<leader>dvs", "<CMD>lua require(\"dap.ui.widgets\").centered_float(require(\"dap.ui.widgets\").scopes, { border = \"none\" })<CR>",
{ "<leader>dvr", function() require("dap").repl.open(nil, "20split") end, desc = "show repl" },
{ "<leader>dvs", function() require("dap.ui.widgets").centered_float(require("dap.ui.widgets").scopes, { border = "none" }) end,
desc = "show scopes" },
{ "<leader>dvt", "<CMD>lua require(\"dap.ui.widgets\").centered_float(require(\"dap.ui.widgets\").threads, { border = \"none\" })<CR>",
{ "<leader>dvt", function() require("dap.ui.widgets").centered_float(require("dap.ui.widgets").threads, { border = "none" }) end,
desc = "show threads" },
}
},

}
17 changes: 13 additions & 4 deletions lua/plugins/extras/lang/java.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ return {
progressReportProvider = false,
});

local function print_test_results(items)
if #items > 0 then
vim.cmd([[Trouble quickfix]])
else
vim.cmd([[TroubleClose quickfix]])
end
end

vim.api.nvim_create_autocmd("FileType", {
pattern = "java",
callback = function()
Expand All @@ -80,9 +88,10 @@ return {
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
-- custom keymaps
vim.keymap.set("n", "<leader>co", "<CMD>lua require(\"jdtls\").organize_imports()<CR>", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>ctc", "<CMD>lua require(\"jdtls\").test_class()<CR>", { buffer = buffer, desc = "Nearest Class" })
vim.keymap.set("n", "<leader>ctm", "<CMD>lua require(\"jdtls\").test_nearest_method()<CR>", { buffer = buffer, desc = "Nearest Method" })
vim.keymap.set("n", "<leader>co", function() require("jdtls").organize_imports() end, { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>ctc", function() require("jdtls").test_class({ bufnr = buffer, after_test = print_test_results }) end, { buffer = buffer, desc = "Test Nearest Class" })
vim.keymap.set("n", "<leader>ctm", function() require("jdtls").test_nearest_method({ bufnr = buffer, after_test = print_test_results }) end, { buffer = buffer, desc = "Test Nearest Method" })
vim.keymap.set("n", "<leader>ctr", function() require("jdtls").pick_test({ bufnr = buffer, after_test = print_test_results }) end, { buffer = buffer, desc = "Run Test" })
require("jdtls").setup_dap({ hotcodereplace = "auto" })
require("jdtls").setup.add_commands()
require("jdtls").dap.setup_dap_main_class_configs()
Expand Down Expand Up @@ -158,7 +167,7 @@ return {
},
},
},
initializationOptions = {
init_options = {
extendedClientCapabilities = extendedClientCapabilities,
bundles = bundles,
}
Expand Down

0 comments on commit ccc9e42

Please sign in to comment.