Skip to content
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

postLaunchTask would be very useful #2405

Closed
trstringer opened this issue Jan 27, 2016 · 18 comments
Closed

postLaunchTask would be very useful #2405

trstringer opened this issue Jan 27, 2016 · 18 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality info-needed Issue requires more information from poster
Milestone

Comments

@trstringer
Copy link
Contributor

Currently we have the ability to specify a preLaunchTask in launch.json configurations. This is extremely helpful in running a task that should kick off before launch.

Conversely, there could be post launch tasks that would be helpful to automate their execution. An example of a post launch task would be to, after the launch of the application, open a browser window with a specific URL to the current application.

In summary, a postLaunchTask would be helpful as preLaunchTask is.

@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality labels Jan 27, 2016
@isidorn isidorn added this to the Backlog milestone Jan 27, 2016
@isidorn isidorn removed their assignment Jan 27, 2016
@theBull
Copy link

theBull commented Aug 31, 2017

@weinand any updates on the progress of the postLaunchTask feature? Or perhaps, do you know of any existing extensions that can perform a similar function?

@isidorn
Copy link
Contributor

isidorn commented Sep 1, 2017

We accept PRs that fix this.
Here's a code pointer on how preLaunchTask is implemented
https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/debug/electron-browser/debugService.ts#L892

@isidorn isidorn added the help wanted Issues identified as good community contribution opportunities label Sep 1, 2017
@cleidigh
Copy link
Contributor

@tstringer
@isidorn
I will pick this up for December...

@markm77
Copy link

markm77 commented Jul 21, 2018

Is it possible to support this for compound launch configs - so that, for example, once all my node-js processes are up, inject some scenario data or clear the DB from previous experiment....

@isidorn
Copy link
Contributor

isidorn commented Sep 29, 2020

@trstringer why did you close this? I think this is still an appropraite feature request?
We currently support a postDebugTask which runs after the whole debugging stopped, a postLaunchTask is still not supported as far as I know.

@trstringer
Copy link
Contributor Author

I wasn't sure of the timeline, it was almost a year stale at this point. I'll reopen!

@trstringer trstringer reopened this Sep 29, 2020
@robofearth
Copy link

robofearth commented Apr 8, 2021

Was looking for this and stumbled on this thread (created 2016!!). Definitely would be handy to auto-initiate a task after a debug session has started running. 👍👍

Edit: To clarify, not after a debug session has ended, eg postDebugTask, but after the debug session started and is still active

@xPathin
Copy link

xPathin commented May 7, 2021

I also stumbled on this because I stumbled onto a problem concerning this.
However i think that the lifecycle should be a bit different and more how PostDebug works, which executes before the debugger disconnects (after the debug session).
What i would find much cooler is if we could differentiate between debug and launch and have pre/post tasks for both instances.

PreLaunchTask -> Executes before launch, doesn't care about debugger (exactly how it is now)
PreDebugTask -> Executes right before the debugger attaches
PostLaunchTask -> Executes if launch action aborted or otherwise finished, doesnt care if debugger is attached
PostDebugTask -> Launches after debugger detaches

I wonder why it is not implemented this way and there is only PreLaunch and PostDebug, there must be a bigger reason on this. Does someone have more insight?

@hwmaier
Copy link

hwmaier commented Jul 9, 2021

Likewise, stumbled across this too while looking for something like "postLaunchTask" which allows for example to launch either a telnet client in a terminal or JLinkRTTClient to connect a terminal to a debugging session.

@isidorn isidorn removed their assignment Aug 17, 2021
@isidorn isidorn modified the milestones: On Deck, Backlog Aug 17, 2021
@roblourens roblourens removed the help wanted Issues identified as good community contribution opportunities label Dec 14, 2022
@roblourens
Copy link
Member

Since the original use-case mentions launching a browser after a server has started, I wonder whether https://code.visualstudio.com/docs/editor/debugging#_automatically-open-a-uri-when-debugging-a-server-program is sufficient for this? Does anyone have a scenario that can't be covered with that feature?

@roblourens roblourens added the info-needed Issue requires more information from poster label Dec 14, 2022
@vscodenpa
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2022
@adellhk
Copy link

adellhk commented Jan 12, 2023

@roblourens in our usecase we are generating some code during the build step and we want to then bundle the generated code. It would be ideal to run the tasks that bundle the generated code as a postLaunchTask. For now we are just manually running the tasks after the build is done.

@roblourens
Copy link
Member

Not clear to me why that should be a postLaunchTask rather than part of the preLaunchTask

@adellhk
Copy link

adellhk commented Jan 13, 2023

We're using VS Code and a well-supported VS-code extension to deploy code to Roku.
image
I want to bundle the files generated into out/.roku-deploy-staging after roku-deploy has created them with a hypothetical postLaunchTask after the launch task that we invoked with F5 completes.

@hwmaier
Copy link

hwmaier commented Jan 16, 2023

Does anyone have a scenario that can't be covered with that feature?

Yes, Refer to my comment above. With debuggers for embedded targets like the JLink Cortex ARM debugger you cannot use the postLaunch task because the debugger is not active yet. Certain things can only be done after the debugger has been started and at present those cannot be automated due to a missing postLaunchTask.

@roblourens
Copy link
Member

@adellhk I still don't understand why it makes sense to bundle or deploy these files after debugging has already started.

@hwmaier thanks for the explanation. As a workaround it would probably be easy for someone to write an extension that essentially implements a postLaunchTask.

@cHemingway
Copy link

I also have the same scenario as @hwmaier , also in embedded.
I quite often want to attach a program (e.g. a terminal, or J-Link RTT Viewer) to a running debugger, but (without modifying the program) it won't work unless the debugger process has been started.
For this use case, postLaunchTask would be very useful

@roblourens
Copy link
Member

roblourens commented Jan 20, 2023

Thanks. One reason I'm still hesitant to put this in vscode is that "postLaunch" is hard to define. There are multiple points in the debug setup flow that could be considered "postLaunch", and even then, there is no guarantee that the debuggee is in the right state that you need it in to be able to do what you want to do with it, and so I think a general "postLaunchTask" isn't the right direction.

Instead you might try to write an extension that can do what you want. For an example, you can see what we did for the serverReadyAction feature with this extension:

const listener = vscode.debug.onDidStartDebugSession(session => {

We were solving the same problem there - for example, just because the web server process has started and a debugger has attached, it doesn't mean that the server is ready to handle requests, so we need to watch for a custom output string to know when the web server is ready.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests