diff options
| author | David Czihak <git@dcz.at> | 2026-05-07 18:12:39 +0200 |
|---|---|---|
| committer | David Czihak <git@dcz.at> | 2026-05-07 18:12:39 +0200 |
| commit | 384a44bd1189119326350996fcdff1cf4394a8cd (patch) | |
| tree | 489490657c3741396a47f8560f38114c5148e638 /Scripts/main.js | |
| parent | ae2337094ff86c544b1f8b45dca072a4d57957ab (diff) | |
Feat: Add LLDB log creation setting, improve logs
Diffstat (limited to 'Scripts/main.js')
| -rw-r--r-- | Scripts/main.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Scripts/main.js b/Scripts/main.js index 1058dfe..d9aac14 100644 --- a/Scripts/main.js +++ b/Scripts/main.js | |||
| @@ -12,6 +12,7 @@ const CONFIG_KEYS = { | |||
| 12 | zlsEnabled: `${EXTENSION_ID}.zls.enabled`, | 12 | zlsEnabled: `${EXTENSION_ID}.zls.enabled`, |
| 13 | zlsBuildOnSave: `${EXTENSION_ID}.zls.build-on-save`, | 13 | zlsBuildOnSave: `${EXTENSION_ID}.zls.build-on-save`, |
| 14 | zlsDebug: `${EXTENSION_ID}.zls.debug`, | 14 | zlsDebug: `${EXTENSION_ID}.zls.debug`, |
| 15 | lldbDapDebug: `${EXTENSION_ID}.debug-adapter.debug`, | ||
| 15 | }; | 16 | }; |
| 16 | 17 | ||
| 17 | let languageServer = null; | 18 | let languageServer = null; |
| @@ -264,7 +265,7 @@ function lldbDapProxyPath() { | |||
| 264 | } | 265 | } |
| 265 | 266 | ||
| 266 | function debugAdapterLogPath() { | 267 | function debugAdapterLogPath() { |
| 267 | return "/tmp/zig-lldb-dap-proxy.log"; | 268 | return nova.path.join(nova.extension.globalStoragePath, "lldb-dap-proxy.log"); |
| 268 | } | 269 | } |
| 269 | 270 | ||
| 270 | function issueNormalizerScriptPath() { | 271 | function issueNormalizerScriptPath() { |
| @@ -806,12 +807,24 @@ class ZigTaskAssistant { | |||
| 806 | const action = new TaskDebugAdapterAction("zig-lldb-dap"); | 807 | const action = new TaskDebugAdapterAction("zig-lldb-dap"); |
| 807 | action.transport = "stdio"; | 808 | action.transport = "stdio"; |
| 808 | action.command = "/usr/bin/perl"; | 809 | action.command = "/usr/bin/perl"; |
| 809 | action.args = [lldbDapProxyPath(), lldbDapPath, debugAdapterLogPath()]; | 810 | const debugLog = getBooleanConfigValue(CONFIG_KEYS.lldbDapDebug, false); |
| 811 | let logPath; | ||
| 812 | if (debugLog) { | ||
| 813 | try { | ||
| 814 | const p = debugAdapterLogPath(); | ||
| 815 | const dir = nova.path.dirname(p); | ||
| 816 | if (!nova.fs.stat(dir)) nova.fs.mkdir(dir); | ||
| 817 | logPath = p; | ||
| 818 | } catch (_) {} | ||
| 819 | } | ||
| 820 | action.args = logPath | ||
| 821 | ? [lldbDapProxyPath(), lldbDapPath, logPath] | ||
| 822 | : [lldbDapProxyPath(), lldbDapPath]; | ||
| 810 | action.debugRequest = "launch"; | 823 | action.debugRequest = "launch"; |
| 811 | action.env = { | 824 | action.env = { |
| 812 | DYLD_FRAMEWORK_PATH: lldbFrameworkPaths().join(":"), | 825 | DYLD_FRAMEWORK_PATH: lldbFrameworkPaths().join(":"), |
| 813 | NOVA_ZIG_LLDB_DAP_PATH: lldbDapPath, | 826 | NOVA_ZIG_LLDB_DAP_PATH: lldbDapPath, |
| 814 | NOVA_ZIG_DEBUG_LOG: debugAdapterLogPath(), | 827 | ...(logPath ? { NOVA_ZIG_DEBUG_LOG: logPath } : {}), |
| 815 | }; | 828 | }; |
| 816 | action.debugArgs = { | 829 | action.debugArgs = { |
| 817 | program: programPath, | 830 | program: programPath, |
