Skip to content

Commit 9b6c907

Browse files
authored
fix(dap): allow running mains without project (#459)
1 parent c220ee3 commit 9b6c907

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/java-dap/setup.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ end
4141
function Setup:enrich_config(config)
4242
config = vim.deepcopy(config)
4343

44+
-- skip enriching if already enriched
45+
if config.mainClass and config.projectName and config.modulePaths and config.classPaths and config.javaExec then
46+
return config
47+
end
48+
4449
local main = config.mainClass
45-
local project = config.projectName
50+
-- when we set it to empty string, it will create a project with some random
51+
-- string as name
52+
local project = config.projectName or ''
4653

4754
assert(main, 'To enrich the config, mainClass should already be present')
48-
assert(project, 'To enrich the config, projectName should already be present')
4955

5056
if config.request == 'launch' then
5157
self.java_debug:build_workspace(main, project, nil, false)

0 commit comments

Comments
 (0)