From 1228ac674a6ead869659c98b71f1305a5ca14e25 Mon Sep 17 00:00:00 2001 From: s1n7ax Date: Thu, 11 Dec 2025 11:22:09 +0530 Subject: [PATCH] fix(dap): allow running mains without project --- lua/java-dap/setup.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/java-dap/setup.lua b/lua/java-dap/setup.lua index 5973998..cf73550 100644 --- a/lua/java-dap/setup.lua +++ b/lua/java-dap/setup.lua @@ -41,11 +41,17 @@ end function Setup:enrich_config(config) config = vim.deepcopy(config) + -- skip enriching if already enriched + if config.mainClass and config.projectName and config.modulePaths and config.classPaths and config.javaExec then + return config + end + local main = config.mainClass - local project = config.projectName + -- when we set it to empty string, it will create a project with some random + -- string as name + local project = config.projectName or '' assert(main, 'To enrich the config, mainClass should already be present') - assert(project, 'To enrich the config, projectName should already be present') if config.request == 'launch' then self.java_debug:build_workspace(main, project, nil, false)