Fixes #29835: Move Task API from proposed to final.

This commit is contained in:
Dirk Baeumer 2017-06-29 11:03:33 +02:00
parent db88728d44
commit 0e39ec5af5
12 changed files with 404 additions and 341 deletions

17
extensions/grunt/npm-shrinkwrap.json generated Normal file
View file

@ -0,0 +1,17 @@
{
"name": "grunt",
"version": "0.0.1",
"dependencies": {
"@types/node": {
"version": "7.0.32",
"from": "@types/node@>=7.0.12 <8.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.32.tgz",
"dev": true
},
"vscode-nls": {
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
}
}
}

View file

@ -7,7 +7,6 @@
"engines": {
"vscode": "*"
},
"enableProposedApi": true,
"categories": [
"Other"
],

17
extensions/gulp/npm-shrinkwrap.json generated Normal file
View file

@ -0,0 +1,17 @@
{
"name": "gulp",
"version": "0.0.1",
"dependencies": {
"@types/node": {
"version": "7.0.32",
"from": "@types/node@>=7.0.4 <8.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.32.tgz",
"dev": true
},
"vscode-nls": {
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
}
}
}

View file

@ -7,7 +7,6 @@
"engines": {
"vscode": "*"
},
"enableProposedApi": true,
"categories": [
"Other"
],

17
extensions/jake/npm-shrinkwrap.json generated Normal file
View file

@ -0,0 +1,17 @@
{
"name": "jake",
"version": "0.0.1",
"dependencies": {
"@types/node": {
"version": "7.0.32",
"from": "@types/node@>=7.0.18 <8.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.32.tgz",
"dev": true
},
"vscode-nls": {
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
}
}
}

View file

@ -7,7 +7,6 @@
"engines": {
"vscode": "*"
},
"enableProposedApi": true,
"categories": [
"Other"
],

17
extensions/npm/npm-shrinkwrap.json generated Normal file
View file

@ -0,0 +1,17 @@
{
"name": "npm",
"version": "0.0.1",
"dependencies": {
"@types/node": {
"version": "7.0.32",
"from": "@types/node@>=7.0.12 <8.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.32.tgz",
"dev": true
},
"vscode-nls": {
"version": "2.0.2",
"from": "vscode-nls@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-2.0.2.tgz"
}
}
}

View file

@ -4,7 +4,6 @@
"description": "Extension to add task support for npm scripts.",
"displayName": "Npm support for VSCode",
"version": "0.0.1",
"enableProposedApi": true,
"engines": {
"vscode": "0.10.x"
},

View file

@ -10,7 +10,6 @@
"engines": {
"vscode": "*"
},
"enableProposedApi": true,
"dependencies": {
"semver": "4.3.6",
"vscode-extension-telemetry": "0.0.7",

329
src/vs/vscode.d.ts vendored
View file

@ -3537,6 +3537,326 @@ declare module 'vscode' {
update(key: string, value: any): Thenable<void>;
}
/**
* Controls the behaviour of the terminal's visibility.
*/
export enum TaskRevealKind {
/**
* Always brings the terminal to front if the task is executed.
*/
Always = 1,
/**
* Only brings the terminal to front if a problem is detected executing the task
* (e.g. the task couldn't be started because).
*/
Silent = 2,
/**
* The terminal never comes to front when the task is executed.
*/
Never = 3
}
/**
* Controls how the task channel is used between tasks
*/
export enum TaskPanelKind {
/**
* Shares a panel with other tasks. This is the default.
*/
Shared = 1,
/**
* Uses a dedicated panel for this tasks. The panel is not
* shared with other tasks.
*/
Dedicated = 2,
/**
* Creates a new panel whenever this task is executed.
*/
New = 3
}
/**
* Controls how the task is presented in the UI.
*/
export interface TaskPresentationOptions {
/**
* Controls whether the task output is reveal in the user interface.
* Defaults to `RevealKind.Always`.
*/
reveal?: TaskRevealKind;
/**
* Controls whether the command associated with the task is echoed
* in the user interface.
*/
echo?: boolean;
/**
* Controls whether the panel showing the task output is taking focus.
*/
focus?: boolean;
/**
* Controls if the task panel is used for this task only (dedicated),
* shared between tasks (shared) or if a new panel is created on
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/
panel?: TaskPanelKind;
}
/**
* A grouping for tasks. The editor by default supports the
* 'Clean', 'Build', 'RebuildAll' and 'Test' group.
*/
export class TaskGroup {
/**
* The clean task group;
*/
public static Clean: TaskGroup;
/**
* The build task group;
*/
public static Build: TaskGroup;
/**
* The rebuild all task group;
*/
public static Rebuild: TaskGroup;
/**
* The test all task group;
*/
public static Test: TaskGroup;
private constructor(id: string, label: string);
}
/**
* A structure that defines a task kind in the system.
* The value must be JSON-stringifyable.
*/
export interface TaskDefinition {
/**
* The task definition descibing the task provided by an extension.
* Usually a task provider defines more properties to identify
* a task. They need to be defined in the package.json of the
* extension under the 'taskDefinitions' extension point. The npm
* task definition for example looks like this
* ```typescript
* interface NpmTaskDefinition extends TaskDefinition {
* script: string;
* }
* ```
*/
readonly type: string;
/**
* Additional attributes of a concrete task definition.
*/
[name: string]: any;
}
/**
* Options for a process execution
*/
export interface ProcessExecutionOptions {
/**
* The current working directory of the executed program or shell.
* If omitted the tools current workspace root is used.
*/
cwd?: string;
/**
* The additional environment of the executed program or shell. If omitted
* the parent process' environment is used. If provided it is merged with
* the parent process' environment.
*/
env?: { [key: string]: string };
}
/**
* The execution of a task happens as a external process
* without shell interaction.
*/
export class ProcessExecution {
/**
* Creates a process execution.
*
* @param process The process to start.
* @param options Optional options for the started process.
*/
constructor(process: string, options?: ProcessExecutionOptions);
/**
* Creates a process execution.
*
* @param process The process to start.
* @param args Arguments to be passed to the process.
* @param options Optional options for the started process.
*/
constructor(process: string, args: string[], options?: ProcessExecutionOptions);
/**
* The process to be executed.
*/
process: string;
/**
* The arguments passed to the process. Defaults to an empty array.
*/
args: string[];
/**
* The process options used when the process is executed.
* Defaults to undefined.
*/
options?: ProcessExecutionOptions;
}
/**
* Options for a shell execution
*/
export interface ShellExecutionOptions {
/**
* The shell executable.
*/
executable?: string;
/**
* The arguments to be passed to the shell executable used to run the task.
*/
shellArgs?: string[];
/**
* The current working directory of the executed shell.
* If omitted the tools current workspace root is used.
*/
cwd?: string;
/**
* The additional environment of the executed shell. If omitted
* the parent process' environment is used. If provided it is merged with
* the parent process' environment.
*/
env?: { [key: string]: string };
}
export class ShellExecution {
/**
* Creates a process execution.
*
* @param commandLine The command line to execute.
* @param options Optional options for the started the shell.
*/
constructor(commandLine: string, options?: ShellExecutionOptions);
/**
* The shell command line
*/
commandLine: string;
/**
* The shell options used when the command line is executed in a shell.
* Defaults to undefined.
*/
options?: ShellExecutionOptions;
}
/**
* A task to execute
*/
export class Task {
/**
* Creates a new task.
*
* @param definition The task definition as defined in the taskDefintions extension point.
* @param name The task's name. Is presented in the user interface.
* @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
* @param execution The process or shell execution.
* @param problemMatchers the names of problem matchers to use, like '$tsc'
* or '$eslint'. Problem matchers can be contributed by an extension using
* the `problemMatchers` extension point.
*/
constructor(taskDefinition: TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
/**
* The task's definition.
*/
definition: TaskDefinition;
/**
* The task's name
*/
name: string;
/**
* The task's execution engine
*/
execution: ProcessExecution | ShellExecution;
/**
* Whether the task is a background task or not.
*/
isBackground: boolean;
/**
* A human-readable string describing the source of this
* shell task, e.g. 'gulp' or 'npm'.
*/
source: string;
/**
* The task group this tasks belongs to. See TaskGroup
* for a predefined set of available groups.
* Defaults to undefined meaning that the task doesn't
* belong to any special group.
*/
group?: TaskGroup;
/**
* The presentation options. Defaults to an empty literal.
*/
presentationOptions: TaskPresentationOptions;
/**
* The problem matchers attached to the task. Defaults to an empty
* array.
*/
problemMatchers: string[];
}
/**
* A task provider allows to add tasks to the task service.
* A task provider is registerd via #workspace.registerTaskProvider.
*/
export interface TaskProvider {
/**
* Provides tasks.
* @param token A cancellation token.
* @return an array of tasks
*/
provideTasks(token?: CancellationToken): ProviderResult<Task[]>;
/**
* Resolves a task the has no execution set.
* @param task The task to resolve.
* @param token A cancellation token.
* @return the resolved task
*/
resolveTask(task: Task, token?: CancellationToken): ProviderResult<Task>;
}
/**
* Namespace describing the environment the editor runs in.
*/
@ -4459,6 +4779,15 @@ declare module 'vscode' {
* An event that is emitted when the [configuration](#WorkspaceConfiguration) changed.
*/
export const onDidChangeConfiguration: Event<void>;
/**
* 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;
}
/**

View file

@ -26,346 +26,17 @@ declare module 'vscode' {
export const onDidChangeWorkspaceFolders: Event<WorkspaceFoldersChangeEvent>;
}
/**
* Controls the behaviour of the terminal's visibility.
*/
export enum TaskRevealKind {
/**
* Always brings the terminal to front if the task is executed.
*/
Always = 1,
/**
* Only brings the terminal to front if a problem is detected executing the task
* (e.g. the task couldn't be started because).
*/
Silent = 2,
/**
* The terminal never comes to front when the task is executed.
*/
Never = 3
}
/**
* Controls how the task channel is used between tasks
*/
export enum TaskPanelKind {
/**
* Shares a panel with other tasks. This is the default.
*/
Shared = 1,
/**
* Uses a dedicated panel for this tasks. The panel is not
* shared with other tasks.
*/
Dedicated = 2,
/**
* Creates a new panel whenever this task is executed.
*/
New = 3
}
/**
* Controls how the task is presented in the UI.
*/
export interface TaskPresentationOptions {
/**
* Controls whether the task output is reveal in the user interface.
* Defaults to `RevealKind.Always`.
*/
reveal?: TaskRevealKind;
/**
* Controls whether the command associated with the task is echoed
* in the user interface.
*/
echo?: boolean;
/**
* Controls whether the panel showing the task output is taking focus.
*/
focus?: boolean;
/**
* Controls if the task panel is used for this task only (dedicated),
* shared between tasks (shared) or if a new panel is created on
* every task execution (new). Defaults to `TaskInstanceKind.Shared`
*/
panel?: TaskPanelKind;
}
/**
* A grouping for tasks. The editor by default supports the
* 'Clean', 'Build', 'RebuildAll' and 'Test' group.
*/
export class TaskGroup {
/**
* The clean task group;
*/
public static Clean: TaskGroup;
/**
* The build task group;
*/
public static Build: TaskGroup;
/**
* The rebuild all task group;
*/
public static Rebuild: TaskGroup;
/**
* The test all task group;
*/
public static Test: TaskGroup;
private constructor(id: string, label: string);
}
/**
* A structure that defines a task kind in the system.
* The value must be JSON-stringifyable.
*/
export interface TaskDefinition {
/**
* The task definition descibing the task provided by an extension.
* Usually a task provider defines more properties to identify
* a task. They need to be defined in the package.json of the
* extension under the 'taskDefinitions' extension point. The npm
* task definition for example looks like this
* ```typescript
* interface NpmTaskDefinition extends TaskDefinition {
* script: string;
* }
* ```
*/
readonly type: string;
/**
* Additional attributes of a concrete task definition.
*/
[name: string]: any;
}
/**
* Options for a process execution
*/
export interface ProcessExecutionOptions {
/**
* The current working directory of the executed program or shell.
* If omitted the tools current workspace root is used.
*/
cwd?: string;
/**
* The additional environment of the executed program or shell. If omitted
* the parent process' environment is used. If provided it is merged with
* the parent process' environment.
*/
env?: { [key: string]: string };
}
/**
* The execution of a task happens as a external process
* without shell interaction.
*/
export class ProcessExecution {
/**
* Creates a process execution.
*
* @param process The process to start.
* @param options Optional options for the started process.
*/
constructor(process: string, options?: ProcessExecutionOptions);
/**
* Creates a process execution.
*
* @param process The process to start.
* @param args Arguments to be passed to the process.
* @param options Optional options for the started process.
*/
constructor(process: string, args: string[], options?: ProcessExecutionOptions);
/**
* The process to be executed.
*/
process: string;
/**
* The arguments passed to the process. Defaults to an empty array.
*/
args: string[];
/**
* The process options used when the process is executed.
* Defaults to undefined.
*/
options?: ProcessExecutionOptions;
}
/**
* Options for a shell execution
*/
export interface ShellExecutionOptions {
/**
* The shell executable.
*/
executable?: string;
/**
* The arguments to be passed to the shell executable used to run the task.
*/
shellArgs?: string[];
/**
* The current working directory of the executed shell.
* If omitted the tools current workspace root is used.
*/
cwd?: string;
/**
* The additional environment of the executed shell. If omitted
* the parent process' environment is used. If provided it is merged with
* the parent process' environment.
*/
env?: { [key: string]: string };
}
export class ShellExecution {
/**
* Creates a process execution.
*
* @param commandLine The command line to execute.
* @param options Optional options for the started the shell.
*/
constructor(commandLine: string, options?: ShellExecutionOptions);
/**
* The shell command line
*/
commandLine: string;
/**
* The shell options used when the command line is executed in a shell.
* Defaults to undefined.
*/
options?: ShellExecutionOptions;
}
/**
* A task to execute
*/
export class Task {
/**
* Creates a new task.
*
* @param definition The task definition as defined in the taskDefintions extension point.
* @param name The task's name. Is presented in the user interface.
* @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
* @param execution The process or shell execution.
* @param problemMatchers the names of problem matchers to use, like '$tsc'
* or '$eslint'. Problem matchers can be contributed by an extension using
* the `problemMatchers` extension point.
*/
constructor(taskDefinition: TaskDefinition, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
/**
* The task's definition.
*/
definition: TaskDefinition;
/**
* The task's name
*/
name: string;
/**
* The task's execution engine
*/
execution: ProcessExecution | ShellExecution;
/**
* Whether the task is a background task or not.
*/
isBackground: boolean;
/**
* A human-readable string describing the source of this
* shell task, e.g. 'gulp' or 'npm'.
*/
source: string;
/**
* The task group this tasks belongs to. See TaskGroup
* for a predefined set of available groups.
* Defaults to undefined meaning that the task doesn't
* belong to any special group.
*/
group?: TaskGroup;
/**
* The presentation options. Defaults to an empty literal.
*/
presentationOptions: TaskPresentationOptions;
/**
* The problem matchers attached to the task. Defaults to an empty
* array.
*/
problemMatchers: string[];
}
/**
* A task provider allows to add tasks to the task service.
* A task provider is registerd via #workspace.registerTaskProvider.
*/
export interface TaskProvider {
/**
* Provides tasks.
* @param token A cancellation token.
* @return an array of tasks
*/
provideTasks(token?: CancellationToken): ProviderResult<Task[]>;
/**
* Resolves a task the has no execution set.
* @param task The task to resolve.
* @param token A cancellation token.
* @return the resolved task
*/
resolveTask(task: Task, token?: CancellationToken): ProviderResult<Task>;
}
export namespace workspace {
/**
* 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;
export function getConfiguration2(section?: string, resource?: Uri): WorkspaceConfiguration2;
}
export interface WorkspaceConfiguration2 extends WorkspaceConfiguration {
inspect<T>(section: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, folderValue?: T } | undefined;
}
export namespace workspace {
export function getConfiguration2(section?: string, resource?: Uri): WorkspaceConfiguration2;
}
export namespace window {
export function sampleFunction(): Thenable<any>;

View file

@ -440,9 +440,9 @@ export function createApiFactory(
getConfiguration2: proposedApiFunction(extension, (section?: string, resource?: vscode.Uri): vscode.WorkspaceConfiguration => {
return extHostConfiguration.getConfiguration2(section, <URI>resource);
}),
registerTaskProvider: proposedApiFunction(extension, (type: string, provider: vscode.TaskProvider) => {
registerTaskProvider: (type: string, provider: vscode.TaskProvider) => {
return extHostTask.registerTaskProvider(extension, provider);
})
}
};
// namespace: scm