Enable globs on tasks otherwise fallback to default - fixes #88106#141230
Enable globs on tasks otherwise fallback to default - fixes #88106#141230alexr00 merged 14 commits intomicrosoft:mainfrom
Conversation
alexr00
left a comment
There was a problem hiding this comment.
Thanks for the PR! I've added some comments. This will need to go through our API review process first, as the Tasks json schema is partially mirrored in the Tasks extension API, meaning that anything added to the schema has the potential of one day becoming extension API. I will start that process in February.
|
@alexr00 thanks for reviewing. In your opinion do you think glob is in the right place? Or should it be at the top level task Object? |
|
@jasonwilliams I'm on the fence. On the one hand, the |
|
@alexr00 I've added in the changes you've asked for |
|
Thanks for the changes! I noticed that |
|
Hey @alexr00 im guessing this will hopefully role into the march release. Do you know when it gets reviewed? |
alexr00
left a comment
There was a problem hiding this comment.
@jasonwilliams thank you for your patience! I have had a lot of API to work on recently and we haven't had time to go through all of them every week. I have added a comment based on the API feedback I received.
|
Hey @alexr00 I've rebased and added updates. I've tested and it's still working as expected. |
|
@alexr00 i do need your help on something. https://github.com/microsoft/vscode/runs/5694971126?check_suite_focus=true fails because I needed to change this check to be triple equals on true. Otherwise all tasks with However the test seems to use a stringified "true" statement. So do we change the test or the code? I could remove that triple equals and the functionality should still work but wondered if that approach is a good idea. |
|
@jasonwilliams that's a bug in the test, it should not be |
|
I've removed the API changes since we didn't go through full API review and the original feature request doesn't include a request for the API changes. Everything else looks good. I will test this week and merge. |
|
Sounds good @alexr00 I'm guessing now v1.66 is shipped it's is a good time for this to go in. Let me know if i need to write up any documentation for the release notes or anywhere. |
- bring back json schema
|
Rebased, and did some final checks, I actually found a bug. So order of precedence is (for both test and build):
|
|
pings @alexr00 |
|
I'm not going to be able to get to this for April. I will look at it first thing after we have branched for release next week though. |
|
@jasonwilliams I reviewed and tested today. I found an issue where the glob doesn't work when there's only one glob that matches. I fixed it with 1bbc930. My test tasks.json: Then I opened a folder with a |
alexr00
left a comment
There was a problem hiding this comment.
Tested and made a few style/name changes, as well as one bugfix.
|
Thanks @alexr00 |
|
@jasonwilliams nope, no blockers. Just wanted to give you a chance to review my changes if you wanted. |
@alexr00 my apologies, I missed your message above so I didn't test it. But i can take a look at insiders and test there. Thanks for helping me put this feature through. |
|
@alexr00 I was surprised to see no mention of this feature in https://code.visualstudio.com/updates/v1_68#_engineering or the documentation for tasks https://code.visualstudio.com/docs/editor/tasks Will it be added there? It seems a bit of a hidden feature at the moment |
|
@jasonwilliams thanks for the ping. Not including this in the release notes was an oversight: microsoft/vscode-docs#5401 I will update the docs to include this feature soon. |
This PR fixes #88106
VSCode supports
isDefaultwhich is useful when working on a single project but begins to fail on a monorepo or workspaces. Developers want to be able to change the default task depending on what part of the project they're in, and doing this in settings can get cumbersome. This provides the ability to switch default task based on the matching glob of the active file.Previous behaviour is the same if no glob is provided or no glob matches.
This PR isn't perfect but its 90% of the way there, im sure there's areas I haven't properly covered.
I needed to comment out some of the schema because it kept moaning when I added glob to
group.Gif

In this gif I set a glob,
@alexr00 feel free to modify this if you need to add changes for it to go in.