-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add postDebugTask to debugger launch.json #11522
Comments
duplicate of #2405 |
Hi, |
@newbrain you are right. |
Something like this would make clean up after transpiling (for debugging) a bit easier. |
Any update on this |
To be honest I am not undestadning how this is not a duplicate of #2405 All in all, this is still on the backlog. And if demand increases we can consider introducing it in one of the coming releases. |
@isidorn: This one, instead, is asking for a task to be started when the debugging session is terminated ("Stop" button clicked): quite the opposite. My use case: cleanly stopping a local debug server process (OpenOCD) when debugging embedded code, so that the e.g. DUT is properly reset. As for #2405, I used a workaround: start a background script with a "reasonable" delay. |
@newbrain Got it. Thanks for the explanation, |
Main problem at the moment is that there is no way to clean up after debugging ts-compiled code, which all needs to be on the file system in order for vscode to find it. We either need a way to clean up after debugging (this issue), or a way to have vscode debug without the js and map file on the fs. |
@MeirionHughes any suggestions how VS Code could support debugging without js and map files on the filesystem? |
Well I'm currently using webpack-dev-server quite a lot, and it keeps everything in memory and serves up those files when requested by chrome. In principle, all you'd really need is
whenever the in-memory source/sourcemap is compiled by webpack it could then continually update vscode via the API. I would imagine the main innards of how vscode deals with the source-mapping would be unaffected - although perhaps it would need testing to make sure you can actually update the sourcemaps on the fly. For example: hot-module reloading where chrome/chrome-debugger won't actually be refreshing the whole page. |
Having a Post debug task is very help for us to clean up remote connections. |
Would the team consider an external contribution for this? |
@G1itcher yes PRs are welcome, however before writing code feel free to just create a PR with a proposed solution. Once we agree on the structure we can start coding. Also ping me on the pr. Thanks! |
@G1itcher |
Hi @cleidigh. Unfortunately my situation has changed and I've had 0 free time to sit down and look at this. |
I started looking into this How should we call this? Is "postDebugTask" a good name, how about "postLaunchTask"? An alternative to adding a new string field is adding a structured object, something like: "task": {
"name" : "foo",
"whenToExecute": "preLaunch" | "postLaunch" | "onSessionEnd"
} The upside of this is that it makes it a bit clearer when it will be executed and we can also cover #2405. Downside is that strucutred objects are more complex. Let me know what you think @weinand |
@isidorn: Thanks for picking this up. |
@isidorn since we already have a "preLaunchTask" I suggest that we continue to use this naming scheme (and avoid the structured object and the "on*" style). I still like the name "postDebugTask". Restart behaviour: we have two "restart" mechanisms:
I'm pretty sure that "postDebugTask" must not be called in the second case. |
I have pushed the initial support for this. Try it out in tomorrow's vscode insiders and let us know what you think. @weinand what you are saying makes sense, however I think the use case is that people want to deconstruct whatever they contructed in A seperate issue on my end is that I do not know what is the reason that a session stopped, or started so in both those I run I am open to changing this but pushed a first version so we get some feedback. |
@isidorn you said:
This is not true for the "restart" case (2. from above). In this case you receive a "restart" attribute in the "terminate" event, so you could know that a "preLaunchTask" and "postDebugTask" is not needed for an automatic "restart". I don't think that Docker users want to shutdown and relaunch a Docker session on every source code edit. @chrisdias @WebFreak001 @newbrain what do you think? |
@weinand I did not mean it is not possible, just my code is structured in such a way that I do not have that knowledge when I am reacting on seassion has ended event. |
@weinand also it seems than for that scenario we should also not run the preLaunchTask again. So it still feels to me |
That's great news. I'll try the Insider version when it is released! The use case I have is about debugging MCUs.
Some GDB clients allows to start the server from the GDB clients and to stop it when closing the debugging session, but not all. However, even in that case, I haven't figured out how to set all those parameters on the |
Could |
@rei-vilo no, since that would be a breaking change. |
@rei-vilo let's talk about semantics first, and then discuss name changes. @isidorn yes, preLaunchTask should not be called on automatic "restart" (case 2). In the Docker scenario (https://github.com/Microsoft/vscode-recipes/tree/master/Docker-TypeScript) we are lucky and survive multiple activations of the preLaunchTask because it is a background watcher task anyway. |
@weinand I have pushed a change that both preLaunch and postDebug task are not being run on automatic restarts. |
Great, thanks. I'll try my scenarios tomorrow. |
There is preLaunchTask already which runs a task right before debugging, it would be cool also having a
postDebugTask
which would run a task when finishing debugging.Users could then provide a custom start server and stop server task for example.
The text was updated successfully, but these errors were encountered: