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

Allow to provide task definitions through DebugConfiguration.preLaunchTask #78948

Closed
g-arjones opened this issue Aug 12, 2019 · 8 comments
Closed
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 *out-of-scope Posted issue is not in scope of VS Code tasks Task system issues
Milestone

Comments

@g-arjones
Copy link
Contributor

This is a follow-up from: #59337

The goal is to provide a simple mechanism for a DebugConfigurationProvider to create task definitions and use them as prelaunch tasks. A TaskProvider would then be able to pick those up and fill the missing bits. Currently, there is no way to gather data from debugging configurations provided by the user through launch.json and pass it to a task provider so that prelaunch tasks could be created dynamically off the debug configuration.

I will be glad to hear workarounds as well..

@vscodebot
Copy link

vscodebot bot commented Aug 12, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@g-arjones
Copy link
Contributor Author

Not a duplicate.

@isidorn
Copy link
Contributor

isidorn commented Aug 12, 2019

fyi @weinand @alexr00

@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality tasks Task system issues labels Aug 12, 2019
@isidorn isidorn added this to the Backlog milestone Aug 12, 2019
@weinand
Copy link
Contributor

weinand commented Sep 4, 2019

A TaskProvider can easily access the current debug configuration by registering for the start of a debug session via the onDidStartDebugSession API.
@g-arjones have you tried this?

@weinand weinand added the info-needed Issue requires more information from poster label Sep 4, 2019
@g-arjones
Copy link
Contributor Author

No, because my understanding was that the preLaunchtask is launched before the session starts and that onDidStartDebugSession is called after. My goal is to create a task to be used as a prelaunchTask. Am I missing something? @weinand

@isidorn isidorn self-assigned this Oct 8, 2019
@isidorn isidorn added the *out-of-scope Posted issue is not in scope of VS Code label Oct 9, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 9, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 9, 2019
@adriancostin6
Copy link

No, because my understanding was that the preLaunchtask is launched before the session starts and that onDidStartDebugSession is called after. My goal is to create a task to be used as a prelaunchTask. Am I missing something? @weinand

Hello @g-arjones, did you manage to do this? I want to do the same thing now and I am stuck. I want to define a preLaunchTask without having to write a tasks.json file, and would like the extension I write to register this automatically. I am not sure whether this is possible. Any insights?

@adriancostin6
Copy link

adriancostin6 commented Mar 9, 2023

A TaskProvider can easily access the current debug configuration by registering for the start of a debug session via the onDidStartDebugSession API. @g-arjones have you tried this?

@weinand Could you please elaborate on this, if you have the time?

I am trying to start a debugging session by first running a gdbserver instance locally, and then connecting to it with a client. I am doing this to bypass a limitation on Cygwin/MinGW where gdb does not bind breakpoints as it cannot stop a running process, but gdbserver on the other hand works just fine.

I would like to abstract this away from the users of my extension so they do not have to define a task for it in the tasks.json file, and register it as a preLaunchTask in launch.json. The behavior I am seeking is for the user to hit the debug button, a server to start automatically on a local port and then have a client attach to it, all in one go.

The solutions I have researched so far are:

  • registering a custom task, with a task provider, then somehow specifying it as a preLaunchTask for my debug configuration (did not actually invest time in this, as I don't know how to do it yet, and I am unsure if it will work or not)
  • registering a custom task with a task provider, and adding an extra step, for the user to run the task inside vscode (not ideal, same as starting a debug server from the command line as it involves an extra step. same as above, on the uncertainty scale)
  • define a tasks.json file with the preLaunchTask (tried this and it works, but the extra step of defining a tasks.json file is not ideal. unlikely that people will do this, rather than complain)

Later edit: I know this is not a good place to ask questions, but I have already tried my luck on SO, to no avail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality info-needed Issue requires more information from poster *out-of-scope Posted issue is not in scope of VS Code tasks Task system issues
Projects
None yet
Development

No branches or pull requests

5 participants
@weinand @isidorn @g-arjones @adriancostin6 and others