Skip to content

Extensions global tasks #178597

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mahmoudsalah1993
Copy link
Contributor

Resolves #167283

This PR passes the information of the provided task scope allowing extensions to provide global tasks and also persists the recent tasks per profile so global run tasks can be available across workspaces.

This was implemented internally to have workspaces that share the same source code (a monorepo) to then save a build task once and then access it from different created workspaces, and also to view a recently run task on a workspace to run it from a different workspace. For workspace-scoped tasks they remain visible only in their workspace and are configured or saved to the workspace tasks.json.

Mahmoud Khalil and others added 2 commits March 29, 2023 18:17
…file to allow the global tasks run to show up for the profile across different workspaces
@mahmoudsalah1993
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Google"

@meganrogge
Copy link
Contributor

Hey and thank you for the PR.

A task providing extension should only be providing tasks that have something to do with the currently opened folder or workspace - not per profile, since tasks are a workspace/folder concept.

For example, certain scripts won't exist outside of a folder that might be used by a task.

Can you pls help me understand your use case better?

@mahmoudsalah1993
Copy link
Contributor Author

Hi Megan,

Thanks for the quick feedback. In our use case, all code changes are done on a single version of the code that the changes are then routinely submitted back to the main version. Workspaces in that case represents just a different taken copy of the code that the developer would use to apply their changes and then merge back.

We run builds and tests using vscode tasks that define some targets and flags that define the run. We have an extension that provides and resolves those tasks which are Custom execution tasks and not scripts. Our extension can provide some of the tasks for the current open files user has but these tasks are usually more involved requiring specific setup from the user.

The user then defines and runs build or test tasks for the projects they work on within the repository. When creating a new workspace to work on a new change, they would expect to see the tasks they recently run/persisted after Tasks: Run Task be available in whichever workspace they have open. Hence would prefer that a task they had run from the extension be directly saved to the global or profile tasks.json file and not to the workspace-specific file.

In short workspaces, are disposable snapshots where a user works on a specific change, running the tasks they had defined to test their project and then submit the change and disposing of the workspace, and then moving to a new workspace to work on another change which they'd expect to have the same tasks to run. We had made this change on our internal version to address that need, but I understand this might not be the approach that this project would want to take, but we saw some value in our use case to give the ability for extensions to have global tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose User tasks and all task commands in vscode Web
2 participants