Closed devhawk closed 6 months ago
Notes:
preLaunchTask
is implemented by VS Code and is supported on all VS Code debugger types, including the node-terminal
debugger type that the TT DBG CodeLens invokes. We can easily pull the preLaunchTask from configuration and pass it to the startDebugger
call as this PR already does.{
"type": "node-terminal",
"request": "launch",
"name": "Time Travel Debug",
"command": "npx dbos-sdk debug -x ${command:dbos-ttdbg.get-proxy-url} -u ${command:dbos-ttdbg.pick-workflow-id}",
"preLaunchTask": "npm: build",
}
extension.js-debug.createDebuggerTerminal
). Theoretically, this would work for like CodeLens that launch the JS Debugger programmatically. However, this approach seems like more effort than current startDebugger
approach as it doesn't have preLaunchTask support.Significant updates since my last comment. I implemented support for the debug launch config I showed in my last comment. I refactored the workflow picker so that the method info was optional. If you invoke the debugger via the code lens, the WF picker is filtered on the code lens method. If you just run the debug config, the WF picker does not filter on method.
While I left support for retrieving the dbos-ttdbg.debug_pre_launch_task
config value in the code, I changed the code lens implementation to use the first debug configuration that has npx dbos-cloud debug
in its command property, but then substitutes the selected Workflow ID for ${command:dbos-ttdbg.pick-workflow-id}"
. Assuming a single debug config (which seems reasonable given the current implementation), this means we will use the same debug config regardless if we launch the debugger directly or via the Code Lens. The only difference is how the workflow ID selection happens (filtered on method vs not filtered)
It seems that we also need to update the docs on the debugger extension API reference. Could you update the docs as well? It'd be very helpful to provide some sample use cases for debug_pre_launch_task
.
Does this PR support re-compiling the app before the debugger? I might have missed it. It seems that users have to manually define preLaunchTask? But we might safely assume that's
npm run build
preLaunchTask
is supported by the core IDE platform for all debugger extensions, so I suspect VS Code users would expect to set that property to get recompile before debug support. I am going to add .vscode
folder files to our @dbos-inc/dbos-sdk init
template so that new projects are configured correctly out of the box (and to recommend this extension to the user if they open their DBOS app source in VSCode)
This PR adds a new config setting
debug_pre_launch_task
. whatever value is specifed for this config setting will be passed to the TT Debug configuration launched by the code lens. If this is a string that matches an existing named task in tasks.json, it will be run before debugging.Note, I'm looking at a how we might leverage existing launch.json to specify this, but I'm still researching.