Skip to content
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

Finalize Task API #49806

Closed
dbaeumer opened this issue May 14, 2018 · 7 comments
Closed

Finalize Task API #49806

dbaeumer opened this issue May 14, 2018 · 7 comments
Assignees
Labels
plan-item VS Code - planned item for upcoming
Milestone

Comments

@dbaeumer
Copy link
Member

  • move Task API to vscode.d.ts
  • support correlating a task with a terminal.
@dbaeumer dbaeumer self-assigned this May 14, 2018
@dbaeumer dbaeumer added the plan-item VS Code - planned item for upcoming label May 14, 2018
@dbaeumer dbaeumer added this to the May 2018 milestone May 14, 2018
@dbaeumer
Copy link
Member Author

@alpaix and @rickvanprim I added events to the task execution that signals when the underlying process starts and when it ends. The start contains the process id, the end the exitCode.

Please let me know if this will work for you (minus the polling for now).

See also #49665

@dbaeumer
Copy link
Member Author

dbaeumer commented May 15, 2018

Some changes after having an API review:

  • listening on the process start / end will be global as well. It will not be available on the TaskExecution. In general VS Code prefers global listeners over local listeners.
  • I moved the API into a tasks namespace since the workspace namespace would become very filled with tasks specific stuff. @alpaix I left the old API (workspace namespace) in for compatibility. However I would like to remove it as soon as possible. Could you migrate over to the tasks workspace?

The API looks like this now:

	/**
	 * Namespace for tasks functionality.
	 */
	export namespace tasks {

		/**
		 * Register a task provider.
		 *
		 * @param type The task kind type this provider is registered for.
		 * @param provider A task provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerTaskProvider(type: string, provider: TaskProvider): Disposable;

		/**
		 * Fetches all tasks available in the systems. This includes tasks
		 * from `tasks.json` files as well as tasks from task providers
		 * contributed through extensions.
		 *
		 * @param filter a filter to filter the return tasks.
		 */
		export function fetchTasks(filter?: TaskFilter): Thenable<Task[]>;

		/**
		 * Executes a task that is managed by VS Code. The returned
		 * task execution can be used to terminate the task.
		 *
		 * @param task the task to execute
		 */
		export function executeTask(task: Task): Thenable<TaskExecution>;

		/**
		 * The currently active task executions or an empty array.
		 *
		 * @readonly
		 */
		export let taskExecutions: ReadonlyArray<TaskExecution>;

		/**
		 * Fires when a task starts.
		 */
		export const onDidStartTask: Event<TaskStartEvent>;

		/**
		 * Fires when a task ends.
		 */
		export const onDidEndTask: Event<TaskEndEvent>;

		/**
		 * Fires when the underlying process has been started.
		 * This event might not fire for tasks that don't
		 * execute an underlying process.
		 */
		export const onDidStartTaskProcess: Event<TaskProcessStartEvent>;

		/**
		 * Fires when the underlying process has ended.
		 * This event might not fire for tasks that don't
		 * execute an underlying process.
		 */
		export const onDidEndTaskProcess: Event<TaskProcessEndEvent>;
	}

@alpaix
Copy link

alpaix commented May 16, 2018

@dbaumer I'll be happy to migrate as soon as it's available. What's the timeline for enabling the new API in insiders and public? When will it be available for testing?

@dbaeumer
Copy link
Member Author

@alpaix I pushed it today. Will be available in insider tomorrow.

@dbaeumer
Copy link
Member Author

@alpaix I pushed a change today that adds the above API to vscode.d.ts (namespace tasks). I left the old workspace API in proposed but I would like to remove it until end of the week. Can you confirm that you moved to the new task namespace.

@alpaix
Copy link

alpaix commented Jun 7, 2018

@dbaeumer We've decided not to support older proposed API as the Live Share remote tasks functionality is an experimental feature. We'll release a final revision along with the latest stable Task API when it's available in non-insiders VSCode version.

It's okay to remove the proposed API.

@dbaeumer
Copy link
Member Author

dbaeumer commented Jun 7, 2018

@alpaix thanks. I will remove the API then.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plan-item VS Code - planned item for upcoming
Projects
None yet
Development

No branches or pull requests

2 participants