go-task / vscode-task

Task for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=task.vscode-task
MIT License
36 stars 4 forks source link

Look for taskfiles under different workspace folders #128

Open Welding-Torch opened 4 months ago

Welding-Torch commented 4 months ago

So I tend to have my taskfile placed inside a sub-folder in my project, next to where my code is. It would be really convenient if the Taskfile extension could detect that Taskfile.yml and show it to me in the sidebar.

Thanks devs.

Welding-Torch commented 4 months ago

@pd93

robbarrett commented 3 months ago

I'm also looking for a way to do this. My project has lots of subfolders with different build processes, each driven by their own Taskfile.yml. Since there isn't one in the root directory for the project, I am stuck with the extension saying: "No Taskfile found in this workspace. Click the button below to get started and initialize a new Taskfile. (Initialize Taskfile)"

aacebedo commented 2 months ago

same here. Would be great to have a way to scan for taskfiles in a folder hirerarchy

jamcow commented 1 month ago

I searched for this issue too, and solved it manually by adding a root Taskfile.yml (using the Initialize Taskfile button in VSCode) and then including the various Taskfiles wherever they existed. Tasks from the various subfolder tasks are listed and linked in the panel.

Could be worth adding a commented-out "includes example" in the initialize example, or link to documentation.

version: '3'

includes:
  anamespaceforthisfolder:
    taskfile: ./my.Project/Base/Taskfile.yml

  frontend:
    taskfile: ./my.Project/Frontend/Taskfile.yml

  backend:
    taskfile: ./my.Project/Backend/Taskfile.yml
robbarrett commented 1 month ago

That works really well for me, @jamcow -- thank you! Agreed that it would be good to put an example in the docs, if this seems to be a common pattern.

For my situation, it was helpful to also add a dir specification for eachincludes clause, like this:

includes:
  anamespaceforthisfolder:
    taskfile: ./my.Project/Base/Taskfile.yml
    dir: ./my.Project/Base
Welding-Torch commented 1 month ago

@jamcow thanks for sharing this method! I second adding this to the docs, it could help other ppl who want this without having to dig through GitHub Issues.

Still this is just a fix, and it would be really great if Task didn't need it at all. @pd93 it would be great if the Task extension could detect multiple task files nested within folders.