Added close field in vscode.d.ts interface TaskPresntationOptions#131127
Conversation
alexr00
left a comment
There was a problem hiding this comment.
Thanks for the PR! New API must be added to vscode.proposed.d.ts before it can move into vscode.d.ts. Additionally, I would like to understand how you want to use the new close API before we add it.
|
Thanks for looking at it! I moved it into The tasks API is fantastic and allows you to do async tasks more cleanly than using node's child_process and an output, plus I found major performance improvements, it also gives the user more control as they can see clearly in a terminal what code your extension is running and close it if they wish. Not having control to close a task programmatically after completion causes issues, the main one I came across is that I want to do a check on user input to see if a task is running, which can branch to different logic. Another example is I run a few tasks asynchronously, I want the user to be aware of what's going on especially if a task is blocking, but then they're left with a lot of clutter and have to close them manually making a poor ux. I would actually prefer the default to be close after run, but others would prefer it to work how it does now, making this a perfect candidate for an optional field! Additionally I would say if this makes sense as an option when a user is creating their own task in |
alexr00
left a comment
There was a problem hiding this comment.
Looks good. I will merge it in September.
|
@alexr00 Thanks so much, it's a real honor to have a PR accepted for VS Code (no matter how small!) which is my favorite IDE by a long way. |
Although there is an option to close terminal after task completes running in tasks.json, the option didn't exist in vscode.d.ts interface TaskPresntationOptions
Confirmed that this works as expected in a custom extension.
Please see more details in Issue #131125
To test this works, create a task in a VS Code extension with vscode.Task, add the presentation option close: true, and execute the task with vscode.tasks.execute task e.g:
Here is an example of it working:
This PR fixes #131125