From 060d561ba1539c5463ab3af7e23eb272d479ead0 Mon Sep 17 00:00:00 2001 From: k Date: Sat, 31 Aug 2024 20:57:37 +0200 Subject: [PATCH] dap-config: add eval, only define hl for hl projects --- src/HaxeClasspath.hx | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/HaxeClasspath.hx b/src/HaxeClasspath.hx index 363d2e5..80d67c1 100644 --- a/src/HaxeClasspath.hx +++ b/src/HaxeClasspath.hx @@ -113,16 +113,35 @@ class HaxeClasspath { public static function getDapConfig(?hxml:String = "build.hxml"):Void { try { var data = getClasspath(hxml, true); + Sys.println('{'); + + if (data.target == 'hl') { + Sys.println([ + ' {', + ' name="HashLink",', + ' request="launch",', + ' type="hl",', + ' cwd="${data.cwd}",', + ' classPaths={${data.classpath.map(cp -> "\'" + cp + "\'").join(", ")}},', + ' program="${data.out}"', + ' },' + ].join('\n')); + } + Sys.println([ - '{', - ' name="HashLink",', - ' request="launch",', - ' type="hl",', - ' cwd="${data.cwd}",', - ' classPaths={${data.classpath.map(cp -> "\'" + cp + "\'").join(", ")}},', - ' program="${data.out}"', - '}' + ' {', + ' name="Eval",', + ' request="launch",', + ' type="eval",', + ' cwd="${data.cwd}",', + ' classPaths={${data.classpath.map(cp -> "\'" + cp + "\'").join(", ")}},', + ' haxeExecutable={executable="haxe"},', + ' args="${hxml}",', + ' trace=true,', + ' },' ].join('\n')); + + Sys.println('}'); } catch (e) { Utils.displayError(Std.string(e)); }