microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
193 stars 58 forks source link

Implement support for VSCode tasks #101

Open andreeis opened 3 years ago

andreeis commented 3 years ago

The most urgent reason for tasks support is the ability to build before debug/run when launch.json is used. Implementing this will make the commands makefile.launchTargetPath and makefile.launchTargetFileName not useful anymore and we will be able to remove them.

ericis commented 3 years ago

@andreeis I always define .PHONY command orchestrations inside the "./makefile" itself, which handles all of the command dependencies. Would this work for your scenario? This has the added benefit that any engineer that can run make can execute the tasks as defined in the "./makefile" without requiring VS Code.

elupus commented 2 years ago

I second this. I use cortex debug extension for debugging. And I'd like to trigger a build task before starting a debug session. I would also like that C+Shift+B which is the normal task for building would trigger makefile build. Just a "dummy" task inside tasks.json that would trigger the makefile build would work just fine here.

jankap commented 2 years ago

Any updates on this? :)

andreeis commented 2 years ago

@jankap, we were not able to get to this work item yet. This is currently also not part of the upcoming 0.4 release. We would gladly review and test a PR (to be included in a sooner release) if anyone in the community is interested to implement this support before we do.

MightyCreak commented 5 months ago

I would add that when setting up a toolchain in VSCode, you expect to have new tasks and new launch targets in the tasks.json and launch.json (respectively) of the workspace.

I just tried Makefile Tools and it feels like it is using is own solution instead of going with the VSCode's workflow. For instance, if Makefile Tools was using tasks.json and launch,json, it would be very easy for the user to add arguments to any of the tasks or targets.

gcampbell-msft commented 5 months ago

@MightyCreak Could you describe in more detail the scenario and workflow that you're expecting? There shouldn't be anything in the makefile extension that stops you from using tasks.json and launch.json, but are you asking for more support in the Makefile Tools extension regarding this?

It'd be great to get a better understanding of your desired scenario. Thanks!

MightyCreak commented 5 months ago

Keep in mind that, I have a good knowledge of Visual Studio, but my knowledge of VSCode is not that great 😉

From what I understand, the classic way to debug is to hit F5 in VSCode, and to do so you need to setup a "target" in launch.json, and in this target you have a preLaunchTask properties set to the build task form tasks.json.

And this is the part where VSCode is a bit confusing to me. It seems that for some languages, VSCode is able to autogenerate these two files if they don't exist and there is not a lot to do to make it work perfectly.

What I'd expect from Makefile Tools when configuring a new project, would be to add these target and task automatically (if it's possible). So that when I hit F5, it runs make, and if the compilation succeeds, it runs the binary and attach the debugger to it.

Does it make sense?

gcampbell-msft commented 5 months ago

@MightyCreak Ah, that makes sense. Thank you for this feature request.

I think your explanation is likely in step with the thought that @andreeis had when opening this ticket. We'll keep this on the backlog and get to it when we can!