Skip to content

Added close field in vscode.d.ts interface TaskPresntationOptions #131127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2021
Merged

Added close field in vscode.d.ts interface TaskPresntationOptions #131127

merged 1 commit into from
Sep 1, 2021

Conversation

jackos
Copy link
Contributor

@jackos jackos commented Aug 18, 2021

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:

image

Here is an example of it working:

working

This PR fixes #131125

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jackos
Copy link
Contributor Author

jackos commented Aug 20, 2021

Thanks for looking at it! I moved it into vscode.proposed.d.ts.

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 tasks.json, it also makes sense here. Also for developer experience, if we're building extensions it's because we love VS Code and we're familiar with using a tasks.json file, so matching up the programmtic interface makes sense.

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I will merge it in September.

@alexr00 alexr00 added this to the September 2021 milestone Aug 20, 2021
@jackos
Copy link
Contributor Author

jackos commented Aug 27, 2021

@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.

@alexr00 alexr00 merged commit c4c7a3e into microsoft:main Sep 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2021
@jackos jackos deleted the patch-1 branch January 16, 2024 23:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No close field in vscode.d.ts interface TaskPresntationOptions
3 participants