From 259a0096028474965f94ec8927de0170705cfa06 Mon Sep 17 00:00:00 2001 From: Wynd Date: Tue, 17 Mar 2026 01:44:24 +0200 Subject: [PATCH] Some more jdtls and dap config changes --- .../wynd/.config/nvim/lua/nvwynd/keymaps.lua | 6 ---- .../.config/nvim/lua/nvwynd/plugins/dap.lua | 26 +++++++++++++++ .../.config/nvim/lua/nvwynd/plugins/lsp.lua | 32 +++++++++++++++++++ 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/backup/home/wynd/.config/nvim/lua/nvwynd/keymaps.lua b/backup/home/wynd/.config/nvim/lua/nvwynd/keymaps.lua index 1edda61..b152185 100644 --- a/backup/home/wynd/.config/nvim/lua/nvwynd/keymaps.lua +++ b/backup/home/wynd/.config/nvim/lua/nvwynd/keymaps.lua @@ -1,6 +1,5 @@ local map = vim.keymap.set -local jdtls = require("jdtls") local dap = require("dap") local telescope = require("telescope.builtin") local comment_api = require("Comment.api") @@ -16,11 +15,6 @@ map({ "n", "v", "x" }, "", '"_x') -- filthy casual save keybind map({ "n", "i", "v" }, "", function() vim.cmd("w") - local has_dap_session = dap.session() ~= nil - -- If jdtls is available and dap is running also run the hotcode swap automatically - if jdtls and has_dap_session then - vim.cmd("JdtUpdateHotcode") - end end, { desc = "File Save" }) -- easy way to close the current buffer map("n", "", "bd!", { desc = "Close Buffer" }) diff --git a/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/dap.lua b/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/dap.lua index 27d3438..cfe7ef6 100644 --- a/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/dap.lua +++ b/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/dap.lua @@ -1,5 +1,31 @@ return { { "mfussenegger/nvim-dap", + config = function() + local dap = require("dap") + + -- dap.listeners.before.launch.build = function(session) + -- local config = session.config + -- + -- if config.preLaunchTask == "prepareRunClientCompile" then + -- vim.system({ "./gradlew", "prepareRunClientCompile" }):wait() + -- end + -- end + + -- No I'm not gonna fucking use overseer just to run a fucking script + local orig_run = dap.run + dap.run = function(config) + vim.notify("Running task " .. config.preLaunchTask) + if config.preLaunchTask == "prepareRunClientCompile" then + vim.system({ "./gradlew", "prepareRunClientCompile" }, {}, function() + vim.schedule(function() + orig_run(config) + end) + end) + else + orig_run(config) + end + end + end, }, } diff --git a/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/lsp.lua b/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/lsp.lua index b7575d3..9142009 100644 --- a/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/lsp.lua +++ b/backup/home/wynd/.config/nvim/lua/nvwynd/plugins/lsp.lua @@ -64,8 +64,19 @@ return { root_dir = vim.fs.root(0, { "gradlew", ".git", "mvnw" }), + on_attach = function(_, _) + require("jdtls").setup_dap({ hotcodereplace = "auto" }) + require("jdtls.dap").setup_dap_main_class_configs() + end, + settings = { java = { + autobuild = { enabled = true }, + + configuration = { + updateBuildConfiguration = "interactive", + }, + format = { enable = false, settings = { @@ -75,6 +86,27 @@ return { profile = "GoogleStyle", }, }, + + saveActions = { + -- organizeImports = true, + cleanup = true, + }, + + cleanup = { + actions = { + "addOverride", + "addDeprecated", + "qualifyMembers", + "qualifyStaticMembers", + -- "addFinalModifier", + "lambdaExpression", + "lambdaExpressionFromAnonymousClass", + "switchExpression", + "stringConcatToTextBlock", + "instanceofPatternMatch", + "useSwitchForInstanceofPattern", + }, + }, }, },