dbos-inc / ttdbg-extension

DBOS Time Travel Debugger extension for VS Code
https://docs.dbos.dev
MIT License
5 stars 1 forks source link

add dbos-ttdbg.debug_pre_launch_task config setting #14

Closed devhawk closed 6 months ago

devhawk commented 6 months ago

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.

devhawk commented 6 months ago

Notes:

devhawk commented 6 months ago

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)

qianl15 commented 6 months ago

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.

devhawk commented 6 months ago

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)