microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.76k stars 29.1k forks source link

Allow to provide task definitions through DebugConfiguration.preLaunchTask #78948

Closed g-arjones closed 5 years ago

g-arjones commented 5 years ago

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[bot] commented 5 years ago

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

g-arjones commented 5 years ago

Not a duplicate.

isidorn commented 5 years ago

fyi @weinand @alexr00

weinand commented 5 years ago

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?

g-arjones commented 5 years ago

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

vscodebot[bot] commented 5 years ago

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!

adriancostin6 commented 1 year ago

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 commented 1 year ago

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:

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.