diff --git a/extensions/grunt/package.json b/extensions/grunt/package.json
index e8bac905a6945ebdaab01b989c7d454d6b0b9fe8..274d158ab28bdd55a7331849a605872db866a023 100644
--- a/extensions/grunt/package.json
+++ b/extensions/grunt/package.json
@@ -7,6 +7,7 @@
"engines": {
"vscode": "*"
},
+ "enableProposedApi": true,
"categories": [
"Other"
],
diff --git a/extensions/gulp/package.json b/extensions/gulp/package.json
index 5ec491853fef154dacac7022baf0225c0cee540c..6a9845ce00ab7e614880da55f721821f1943ade6 100644
--- a/extensions/gulp/package.json
+++ b/extensions/gulp/package.json
@@ -7,6 +7,7 @@
"engines": {
"vscode": "*"
},
+ "enableProposedApi": true,
"categories": [
"Other"
],
diff --git a/extensions/jake/package.json b/extensions/jake/package.json
index ee5a916ade52f48cf33d25de4b309b29a46a10d8..16892a14655abec39bc09646ed79a565ccf3f93f 100644
--- a/extensions/jake/package.json
+++ b/extensions/jake/package.json
@@ -7,6 +7,7 @@
"engines": {
"vscode": "*"
},
+ "enableProposedApi": true,
"categories": [
"Other"
],
diff --git a/extensions/typescript/package.json b/extensions/typescript/package.json
index 7d5105c3dca38338826c87de702776441ee7bde9..74700e642b765cb7c5042b9ecd2d5fdabed3d160 100644
--- a/extensions/typescript/package.json
+++ b/extensions/typescript/package.json
@@ -10,6 +10,7 @@
"engines": {
"vscode": "*"
},
+ "enableProposedApi": true,
"dependencies": {
"semver": "4.3.6",
"vscode-extension-telemetry": "^0.0.7",
diff --git a/extensions/typescript/src/typings/ref.d.ts b/extensions/typescript/src/typings/ref.d.ts
index bc057c55878395a9f4efb944714cf5c187c5e140..954bab971e334e14fa8f34ff84e325dac3bafc40 100644
--- a/extensions/typescript/src/typings/ref.d.ts
+++ b/extensions/typescript/src/typings/ref.d.ts
@@ -4,4 +4,5 @@
*--------------------------------------------------------------------------------------------*/
///
+///
///
diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts
index 4e5e206c8afd460501d5ebc4d800bc8fdf7a5460..1943316e02624e894937a586477f88380ae000ef 100644
--- a/src/vs/vscode.d.ts
+++ b/src/vs/vscode.d.ts
@@ -3537,335 +3537,6 @@ declare module 'vscode' {
update(key: string, value: any): Thenable;
}
- /**
- * 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 terminal specific behavior.
- */
- export interface TaskTerminalBehavior {
- /**
- * Controls whether the terminal executing a task is brought to front or not.
- * Defaults to `RevealKind.Always`.
- */
- reveal?: TaskRevealKind;
-
- /**
- * Controls whether the command is echoed in the terminal or not.
- */
- echo?: boolean;
- }
-
- export interface ProcessTaskOptions {
- /**
- * 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 };
- }
-
- export namespace TaskGroup {
- /**
- * The clean task group
- */
- export const Clean: 'clean';
- /**
- * The build task group. If a task is part of the build task group
- * it can be executed via the run build short cut.
- */
- export const Build: 'build';
- /**
- * The rebuild all task group
- */
- export const RebuildAll: 'rebuildAll';
- /**
- * The test task group. If a task is part of the test task group
- * it can be executed via the run test short cut.
- */
- export const Test: 'test';
- }
-
- /**
- * A task that starts an external process.
- */
- export class ProcessTask {
-
- /**
- * Creates a process task.
- *
- * @param name the task's name. Is presented in the user interface.
- * @param process the process to start.
- * @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(name: string, process: string, problemMatchers?: string | string[]);
-
- /**
- * Creates a process task.
- *
- * @param name the task's name. Is presented in the user interface.
- * @param process the process to start.
- * @param args arguments to be passed to the process.
- * @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(name: string, process: string, args: string[], problemMatchers?: string | string[]);
-
- /**
- * Creates a process task.
- *
- * @param name the task's name. Is presented in the user interface.
- * @param process the process to start.
- * @param args arguments to be passed to the process.
- * @param options additional options for the started process.
- * @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(name: string, process: string, args: string[], options: ProcessTaskOptions, problemMatchers?: string | string[]);
-
- /**
- * The task's name
- */
- readonly name: string;
-
- /**
- * The task's identifier. If omitted the internal identifier will
- * be `${extensionName}:${name}`
- */
- identifier: string | undefined;
-
- /**
- * Whether the task is a background task or not.
- */
- isBackground: boolean;
-
- /**
- * The process to be executed.
- */
- readonly process: string;
-
- /**
- * The arguments passed to the process. Defaults to an empty array.
- */
- args: string[];
-
- /**
- * A human-readable string describing the source of this
- * shell task, e.g. 'gulp' or 'npm'.
- */
- source: string | undefined;
-
- /**
- * 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: string | undefined;
-
- /**
- * The process options used when the process is executed.
- * Defaults to an empty object literal.
- */
- options: ProcessTaskOptions;
-
- /**
- * The terminal behavior. Defaults to an empty object literal.
- */
- terminalBehavior: TaskTerminalBehavior;
-
- /**
- * The problem matchers attached to the task. Defaults to an empty
- * array.
- */
- problemMatchers: string[];
- }
-
- export type ShellTaskOptions = {
- /**
- * 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 };
- } | {
- /**
- * 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 };
- } | {
- /**
- * 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 };
- };
-
- /**
- * A task that executes a shell command.
- */
- export class ShellTask {
-
- /**
- * Creates a shell task.
- *
- * @param name the task's name. Is presented in the user interface.
- * @param commandLine the command line to execute.
- * @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(name: string, commandLine: string, problemMatchers?: string | string[]);
-
- /**
- * Creates a shell task.
- *
- * @param name the task's name. Is presented in the user interface.
- * @param commandLine the command line to execute.
- * @param options additional options used when creating the shell.
- * @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(name: string, commandLine: string, options: ShellTaskOptions, problemMatchers?: string | string[]);
-
- /**
- * The task's name
- */
- readonly name: string;
-
- /**
- * The task's identifier. If omitted the internal identifier will
- * be `${extensionName}:${name}`
- */
- identifier: string | undefined;
-
- /**
- * Whether the task is a background task or not.
- */
- isBackground: boolean;
-
- /**
- * The command line to execute.
- */
- readonly commandLine: string;
-
- /**
- * A human-readable string describing the source of this
- * shell task, e.g. 'gulp' or 'npm'.
- */
- source: string | undefined;
-
- /**
- * 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: string | undefined;
-
- /**
- * The shell options used when the shell is executed. Defaults to an
- * empty object literal.
- */
- options: ShellTaskOptions;
-
- /**
- * The terminal behavior. Defaults to an empty object literal.
- */
- terminalBehavior: TaskTerminalBehavior;
-
- /**
- * The problem matchers attached to the task. Defaults to an empty
- * array.
- */
- problemMatchers: string[];
- }
-
- export type Task = ProcessTask | ShellTask;
-
- /**
- * A task provider allows to add tasks to the task service.
- * A task provider is registerd via #workspace.registerTaskProvider.
- */
- export interface TaskProvider {
- /**
- * Provides additional tasks.
- * @param token A cancellation token.
- * @return a #TaskSet
- */
- provideTasks(token: CancellationToken): ProviderResult;
- }
-
- export namespace workspace {
- /**
- * Register a task provider.
- *
- * @param provider A task provider.
- * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
- */
- export function registerTaskProvider(provider: TaskProvider): Disposable;
- }
-
/**
* Namespace describing the environment the editor runs in.
*/
diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts
index 89aad78d4047aa5185f051798d795ee85960313e..c4ec6306a2565158a89a330b78eae729d3045a45 100644
--- a/src/vs/vscode.proposed.d.ts
+++ b/src/vs/vscode.proposed.d.ts
@@ -7,6 +7,335 @@
declare module 'vscode' {
+ /**
+ * 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 terminal specific behavior.
+ */
+ export interface TaskTerminalBehavior {
+ /**
+ * Controls whether the terminal executing a task is brought to front or not.
+ * Defaults to `RevealKind.Always`.
+ */
+ reveal?: TaskRevealKind;
+
+ /**
+ * Controls whether the command is echoed in the terminal or not.
+ */
+ echo?: boolean;
+ }
+
+ export interface ProcessTaskOptions {
+ /**
+ * 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 };
+ }
+
+ export namespace TaskGroup {
+ /**
+ * The clean task group
+ */
+ export const Clean: 'clean';
+ /**
+ * The build task group. If a task is part of the build task group
+ * it can be executed via the run build short cut.
+ */
+ export const Build: 'build';
+ /**
+ * The rebuild all task group
+ */
+ export const RebuildAll: 'rebuildAll';
+ /**
+ * The test task group. If a task is part of the test task group
+ * it can be executed via the run test short cut.
+ */
+ export const Test: 'test';
+ }
+
+ /**
+ * A task that starts an external process.
+ */
+ export class ProcessTask {
+
+ /**
+ * Creates a process task.
+ *
+ * @param name the task's name. Is presented in the user interface.
+ * @param process the process to start.
+ * @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(name: string, process: string, problemMatchers?: string | string[]);
+
+ /**
+ * Creates a process task.
+ *
+ * @param name the task's name. Is presented in the user interface.
+ * @param process the process to start.
+ * @param args arguments to be passed to the process.
+ * @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(name: string, process: string, args: string[], problemMatchers?: string | string[]);
+
+ /**
+ * Creates a process task.
+ *
+ * @param name the task's name. Is presented in the user interface.
+ * @param process the process to start.
+ * @param args arguments to be passed to the process.
+ * @param options additional options for the started process.
+ * @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(name: string, process: string, args: string[], options: ProcessTaskOptions, problemMatchers?: string | string[]);
+
+ /**
+ * The task's name
+ */
+ readonly name: string;
+
+ /**
+ * The task's identifier. If omitted the internal identifier will
+ * be `${extensionName}:${name}`
+ */
+ identifier: string | undefined;
+
+ /**
+ * Whether the task is a background task or not.
+ */
+ isBackground: boolean;
+
+ /**
+ * The process to be executed.
+ */
+ readonly process: string;
+
+ /**
+ * The arguments passed to the process. Defaults to an empty array.
+ */
+ args: string[];
+
+ /**
+ * A human-readable string describing the source of this
+ * shell task, e.g. 'gulp' or 'npm'.
+ */
+ source: string | undefined;
+
+ /**
+ * 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: string | undefined;
+
+ /**
+ * The process options used when the process is executed.
+ * Defaults to an empty object literal.
+ */
+ options: ProcessTaskOptions;
+
+ /**
+ * The terminal behavior. Defaults to an empty object literal.
+ */
+ terminalBehavior: TaskTerminalBehavior;
+
+ /**
+ * The problem matchers attached to the task. Defaults to an empty
+ * array.
+ */
+ problemMatchers: string[];
+ }
+
+ export type ShellTaskOptions = {
+ /**
+ * 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 };
+ } | {
+ /**
+ * 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 };
+ } | {
+ /**
+ * 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 };
+ };
+
+ /**
+ * A task that executes a shell command.
+ */
+ export class ShellTask {
+
+ /**
+ * Creates a shell task.
+ *
+ * @param name the task's name. Is presented in the user interface.
+ * @param commandLine the command line to execute.
+ * @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(name: string, commandLine: string, problemMatchers?: string | string[]);
+
+ /**
+ * Creates a shell task.
+ *
+ * @param name the task's name. Is presented in the user interface.
+ * @param commandLine the command line to execute.
+ * @param options additional options used when creating the shell.
+ * @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(name: string, commandLine: string, options: ShellTaskOptions, problemMatchers?: string | string[]);
+
+ /**
+ * The task's name
+ */
+ readonly name: string;
+
+ /**
+ * The task's identifier. If omitted the internal identifier will
+ * be `${extensionName}:${name}`
+ */
+ identifier: string | undefined;
+
+ /**
+ * Whether the task is a background task or not.
+ */
+ isBackground: boolean;
+
+ /**
+ * The command line to execute.
+ */
+ readonly commandLine: string;
+
+ /**
+ * A human-readable string describing the source of this
+ * shell task, e.g. 'gulp' or 'npm'.
+ */
+ source: string | undefined;
+
+ /**
+ * 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: string | undefined;
+
+ /**
+ * The shell options used when the shell is executed. Defaults to an
+ * empty object literal.
+ */
+ options: ShellTaskOptions;
+
+ /**
+ * The terminal behavior. Defaults to an empty object literal.
+ */
+ terminalBehavior: TaskTerminalBehavior;
+
+ /**
+ * The problem matchers attached to the task. Defaults to an empty
+ * array.
+ */
+ problemMatchers: string[];
+ }
+
+ export type Task = ProcessTask | ShellTask;
+
+ /**
+ * A task provider allows to add tasks to the task service.
+ * A task provider is registerd via #workspace.registerTaskProvider.
+ */
+ export interface TaskProvider {
+ /**
+ * Provides additional tasks.
+ * @param token A cancellation token.
+ * @return a #TaskSet
+ */
+ provideTasks(token: CancellationToken): ProviderResult;
+ }
+
+ export namespace workspace {
+ /**
+ * Register a task provider.
+ *
+ * @param provider A task provider.
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
+ */
+ export function registerTaskProvider(provider: TaskProvider): Disposable;
+ }
+
export namespace window {
export function sampleFunction(): Thenable;
diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts
index a859a1369fe2fdf2953902649f8c445c0067b7e1..065f16fc76c49dd94c18787f52cd472af99bc41d 100644
--- a/src/vs/workbench/api/node/extHost.api.impl.ts
+++ b/src/vs/workbench/api/node/extHost.api.impl.ts
@@ -448,9 +448,9 @@ export function createApiFactory(
getConfiguration: (section?: string): vscode.WorkspaceConfiguration => {
return extHostConfiguration.getConfiguration(section);
},
- registerTaskProvider: (provider: vscode.TaskProvider) => {
+ registerTaskProvider: proposedApiFunction(extension, (provider: vscode.TaskProvider) => {
return extHostTask.registerTaskProvider(extension, provider);
- }
+ })
};
class SCM {
diff --git a/src/vs/workbench/parts/tasks/common/taskConfiguration.ts b/src/vs/workbench/parts/tasks/common/taskConfiguration.ts
index f39f7786efa12254e59f6544ac648d88ad62529f..8d7903008c973849722c9d44c562619b32e02903 100644
--- a/src/vs/workbench/parts/tasks/common/taskConfiguration.ts
+++ b/src/vs/workbench/parts/tasks/common/taskConfiguration.ts
@@ -1101,6 +1101,8 @@ namespace Globals {
export namespace ExecutionEngine {
+ export const _default: Tasks.ExecutionEngine = Tasks.ExecutionEngine.Process;
+
export function from(config: ExternalTaskRunnerConfiguration): Tasks.ExecutionEngine {
let runner = config.runner || config._runner;
let result: Tasks.ExecutionEngine;
@@ -1128,16 +1130,20 @@ export namespace ExecutionEngine {
export namespace JsonSchemaVersion {
+ export const _default: Tasks.JsonSchemaVersion = Tasks.JsonSchemaVersion.V0_1_0;
+
export function from(config: ExternalTaskRunnerConfiguration): Tasks.JsonSchemaVersion {
let version = config.version;
if (!version) {
- return Tasks.JsonSchemaVersion.V2_0_0;
+ return _default;
}
switch (version) {
case '0.1.0':
return Tasks.JsonSchemaVersion.V0_1_0;
- default:
+ case '2.0.0':
return Tasks.JsonSchemaVersion.V2_0_0;
+ default:
+ return _default;
}
}
}
diff --git a/src/vs/workbench/parts/tasks/common/taskTemplates.ts b/src/vs/workbench/parts/tasks/common/taskTemplates.ts
index b88527097caf0d0a3c7c3cc0d0214d768aafa1f6..461062f19a8826e825941b9712082f255505d292 100644
--- a/src/vs/workbench/parts/tasks/common/taskTemplates.ts
+++ b/src/vs/workbench/parts/tasks/common/taskTemplates.ts
@@ -14,6 +14,7 @@ export interface TaskEntry extends IPickOpenEntry {
content: string;
}
+/* Version 2.0 templates
const dotnetBuild: TaskEntry = {
id: 'dotnetCore',
label: '.NET Core',
@@ -127,3 +128,220 @@ export let templates: TaskEntry[] = [dotnetBuild, msbuild, maven].sort((a, b) =>
return (a.sort || a.label).localeCompare(b.sort || b.label);
});
templates.push(command);
+*/
+
+const gulp: TaskEntry = {
+ id: 'gulp',
+ label: 'Gulp',
+ autoDetect: true,
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "gulp",',
+ '\t"isShellCommand": true,',
+ '\t"args": ["--no-color"],',
+ '\t"showOutput": "always"',
+ '}'
+ ].join('\n')
+};
+
+const grunt: TaskEntry = {
+ id: 'grunt',
+ label: 'Grunt',
+ autoDetect: true,
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "grunt",',
+ '\t"isShellCommand": true,',
+ '\t"args": ["--no-color"],',
+ '\t"showOutput": "always"',
+ '}'
+ ].join('\n')
+};
+
+const npm: TaskEntry = {
+ id: 'npm',
+ label: 'npm',
+ sort: 'NPM',
+ autoDetect: false,
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "npm",',
+ '\t"isShellCommand": true,',
+ '\t"showOutput": "always",',
+ '\t"suppressTaskName": true,',
+ '\t"tasks": [',
+ '\t\t{',
+ '\t\t\t"taskName": "install",',
+ '\t\t\t"args": ["install"]',
+ '\t\t},',
+ '\t\t{',
+ '\t\t\t"taskName": "update",',
+ '\t\t\t"args": ["update"]',
+ '\t\t},',
+ '\t\t{',
+ '\t\t\t"taskName": "test",',
+ '\t\t\t"args": ["run", "test"]',
+ '\t\t}',
+ '\t]',
+ '}'
+ ].join('\n')
+};
+
+const tscConfig: TaskEntry = {
+ id: 'tsc.config',
+ label: 'TypeScript - tsconfig.json',
+ autoDetect: false,
+ description: nls.localize('tsc.config', 'Compiles a TypeScript project'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "tsc",',
+ '\t"isShellCommand": true,',
+ '\t"args": ["-p", "."],',
+ '\t"showOutput": "silent",',
+ '\t"problemMatcher": "$tsc"',
+ '}'
+ ].join('\n')
+};
+
+const tscWatch: TaskEntry = {
+ id: 'tsc.watch',
+ label: 'TypeScript - Watch Mode',
+ autoDetect: false,
+ description: nls.localize('tsc.watch', 'Compiles a TypeScript project in watch mode'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "tsc",',
+ '\t"isShellCommand": true,',
+ '\t"args": ["-w", "-p", "."],',
+ '\t"showOutput": "silent",',
+ '\t"isBackground": true,',
+ '\t"problemMatcher": "$tsc-watch"',
+ '}'
+ ].join('\n')
+};
+
+const dotnetBuild: TaskEntry = {
+ id: 'dotnetCore',
+ label: '.NET Core',
+ sort: 'NET Core',
+ autoDetect: false,
+ description: nls.localize('dotnetCore', 'Executes .NET Core build command'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "dotnet",',
+ '\t"isShellCommand": true,',
+ '\t"args": [],',
+ '\t"tasks": [',
+ '\t\t{',
+ '\t\t\t"taskName": "build",',
+ '\t\t\t"args": [ ],',
+ '\t\t\t"isBuildCommand": true,',
+ '\t\t\t"showOutput": "silent",',
+ '\t\t\t"problemMatcher": "$msCompile"',
+ '\t\t}',
+ '\t]',
+ '}'
+ ].join('\n')
+};
+
+const msbuild: TaskEntry = {
+ id: 'msbuild',
+ label: 'MSBuild',
+ autoDetect: false,
+ description: nls.localize('msbuild', 'Executes the build target'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "msbuild",',
+ '\t"args": [',
+ '\t\t// Ask msbuild to generate full paths for file names.',
+ '\t\t"/property:GenerateFullPaths=true"',
+ '\t],',
+ '\t"taskSelector": "/t:",',
+ '\t"showOutput": "silent",',
+ '\t"tasks": [',
+ '\t\t{',
+ '\t\t\t"taskName": "build",',
+ '\t\t\t// Show the output window only if unrecognized errors occur.',
+ '\t\t\t"showOutput": "silent",',
+ '\t\t\t// Use the standard MS compiler pattern to detect errors, warnings and infos',
+ '\t\t\t"problemMatcher": "$msCompile"',
+ '\t\t}',
+ '\t]',
+ '}'
+ ].join('\n')
+};
+
+const command: TaskEntry = {
+ id: 'externalCommand',
+ label: 'Others',
+ autoDetect: false,
+ description: nls.localize('externalCommand', 'Example to run an arbitrary external command'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "echo",',
+ '\t"isShellCommand": true,',
+ '\t"args": ["Hello World"],',
+ '\t"showOutput": "always"',
+ '}'
+ ].join('\n')
+};
+
+const maven: TaskEntry = {
+ id: 'maven',
+ label: 'maven',
+ sort: 'MVN',
+ autoDetect: false,
+ description: nls.localize('Maven', 'Executes common maven commands'),
+ content: [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ '\t"version": "0.1.0",',
+ '\t"command": "mvn",',
+ '\t"isShellCommand": true,',
+ '\t"showOutput": "always",',
+ '\t"suppressTaskName": true,',
+ '\t"tasks": [',
+ '\t\t{',
+ '\t\t\t"taskName": "verify",',
+ '\t\t\t"args": ["-B", "verify"],',
+ '\t\t\t"isBuildCommand": true',
+ '\t\t},',
+ '\t\t{',
+ '\t\t\t"taskName": "test",',
+ '\t\t\t"args": ["-B", "test"],',
+ '\t\t\t"isTestCommand": true',
+ '\t\t}',
+ '\t]',
+ '}'
+ ].join('\n')
+};
+
+export let templates: TaskEntry[] = [gulp, grunt, tscConfig, tscWatch, dotnetBuild, msbuild, npm, maven].sort((a, b) => {
+ return (a.sort || a.label).localeCompare(b.sort || b.label);
+});
+templates.push(command);
diff --git a/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts b/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts
index e12e519fc0283a5f92facae116c015ba96b3ef40..3a60d35d08892b264448a3268eacabee7bec1067 100644
--- a/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts
+++ b/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts
@@ -20,8 +20,8 @@ const shellCommand: IJSONSchema = {
{
$ref: '#definitions/shellConfiguration'
}
- ],
- deprecationMessage: nls.localize('JsonSchema.tasks.isShellCommand.deprecated', 'The property isShellCommand is deprecated. Use the type property and the shell property in the options instead.')
+ ]
+ // deprecationMessage: nls.localize('JsonSchema.tasks.isShellCommand.deprecated', 'The property isShellCommand is deprecated. Use the type property and the shell property in the options instead.')
};
const dependsOn: IJSONSchema = {
@@ -124,10 +124,10 @@ let definitions = schema.definitions;
definitions.commandConfiguration.properties.isShellCommand = Objects.deepClone(shellCommand);
definitions.taskDescription.properties.isShellCommand = Objects.deepClone(shellCommand);
definitions.taskDescription.properties.dependsOn = dependsOn;
-definitions.showOutputType.deprecationMessage = nls.localize('JsonSchema.tasks.showOputput.deprecated', 'The property showOutput is deprecated. Use the terminal property instead.');
-definitions.taskDescription.properties.echoCommand.deprecationMessage = nls.localize('JsonSchema.tasks.echoCommand.deprecated', 'The property echoCommand is deprecated. Use the terminal property instead.');
-definitions.taskDescription.properties.isBuildCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isBuildCommand.deprecated', 'The property isBuildCommand is deprecated. Use the group property instead.');
-definitions.taskDescription.properties.isTestCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isTestCommand.deprecated', 'The property isTestCommand is deprecated. Use the group property instead.');
+// definitions.showOutputType.deprecationMessage = nls.localize('JsonSchema.tasks.showOputput.deprecated', 'The property showOutput is deprecated. Use the terminal property instead.');
+// definitions.taskDescription.properties.echoCommand.deprecationMessage = nls.localize('JsonSchema.tasks.echoCommand.deprecated', 'The property echoCommand is deprecated. Use the terminal property instead.');
+// definitions.taskDescription.properties.isBuildCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isBuildCommand.deprecated', 'The property isBuildCommand is deprecated. Use the group property instead.');
+// definitions.taskDescription.properties.isTestCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isTestCommand.deprecated', 'The property isTestCommand is deprecated. Use the group property instead.');
definitions.taskDescription.properties.identifier = identifier;
definitions.taskDescription.properties.type = Objects.deepClone(taskType);
definitions.taskDescription.properties.terminal = terminal;
diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
index f6a16bb6ba81b759814d66512445befd3f21ad94..317f79f6ef14fedc79e227c9c9d58c12a4e4054e 100644
--- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
+++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
@@ -119,6 +119,52 @@ abstract class OpenTaskConfigurationAction extends Action {
if (!selection) {
return undefined;
}
+ let contentPromise: TPromise;
+ if (selection.autoDetect) {
+ const outputChannel = this.outputService.getChannel(TaskService.OutputChannelId);
+ outputChannel.show(true);
+ outputChannel.append(nls.localize('ConfigureTaskRunnerAction.autoDetecting', 'Auto detecting tasks for {0}', selection.id) + '\n');
+ let detector = new ProcessRunnerDetector(this.fileService, this.contextService, this.configurationResolverService);
+ contentPromise = detector.detect(false, selection.id).then((value) => {
+ let config = value.config;
+ if (value.stderr && value.stderr.length > 0) {
+ value.stderr.forEach((line) => {
+ outputChannel.append(line + '\n');
+ });
+ if (config && (!config.tasks || config.tasks.length === 0)) {
+ this.messageService.show(Severity.Warning, nls.localize('ConfigureTaskRunnerAction.autoDetect', 'Auto detecting the task system failed. Using default template. Consult the task output for details.'));
+ return selection.content;
+ } else {
+ this.messageService.show(Severity.Warning, nls.localize('ConfigureTaskRunnerAction.autoDetectError', 'Auto detecting the task system produced errors. Consult the task output for details.'));
+ }
+ }
+ if (config) {
+ if (value.stdout && value.stdout.length > 0) {
+ value.stdout.forEach(line => outputChannel.append(line + '\n'));
+ }
+ let content = JSON.stringify(config, null, '\t');
+ content = [
+ '{',
+ '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
+ '\t// for the documentation about the tasks.json format',
+ ].join('\n') + content.substr(1);
+ return content;
+ } else {
+ return selection.content;
+ }
+ });
+ } else {
+ contentPromise = TPromise.as(selection.content);
+ }
+ return contentPromise.then(content => {
+ let editorConfig = this.configurationService.getConfiguration();
+ if (editorConfig.editor.insertSpaces) {
+ content = content.replace(/(\n)(\t+)/g, (_, s1, s2) => s1 + strings.repeat(' ', s2.length * editorConfig.editor.tabSize));
+ }
+ configFileCreated = true;
+ return this.fileService.createFile(this.contextService.toResource('.vscode/tasks.json'), content);
+ });
+ /* 2.0 version
let content = selection.content;
let editorConfig = this.configurationService.getConfiguration();
if (editorConfig.editor.insertSpaces) {
@@ -126,6 +172,7 @@ abstract class OpenTaskConfigurationAction extends Action {
}
configFileCreated = true;
return this.fileService.createFile(this.contextService.toResource('.vscode/tasks.json'), content);
+ */
});
}).then((stat) => {
if (!stat) {
@@ -1016,8 +1063,9 @@ class TaskService extends EventEmitter implements ITaskService {
if (hasParseErrors) {
return TPromise.as({ set: undefined, hasErrors: true });
}
+ let engine = TaskConfig.ExecutionEngine._default;
if (config) {
- let engine = TaskConfig.ExecutionEngine.from(config);
+ engine = TaskConfig.ExecutionEngine.from(config);
if (engine === ExecutionEngine.Process) {
if (this.hasDetectorSupport(config)) {
configPromise = new ProcessRunnerDetector(this.fileService, this.contextService, this.configurationResolverService, config).detect(true).then((value): WorkspaceConfigurationResult => {
@@ -1052,7 +1100,14 @@ class TaskService extends EventEmitter implements ITaskService {
configPromise = TPromise.as({ config, hasErrors: false });
}
} else {
- configPromise = TPromise.as({ config, hasErrors: false });
+ if (engine === ExecutionEngine.Terminal) {
+ configPromise = TPromise.as({ config, hasErrors: false });
+ } else {
+ configPromise = new ProcessRunnerDetector(this.fileService, this.contextService, this.configurationResolverService).detect(true).then((value) => {
+ let hasErrors = this.printStderr(value.stderr);
+ return { config: value.config, hasErrors };
+ });
+ }
}
}
return configPromise.then((resolved) => {
@@ -1092,7 +1147,7 @@ class TaskService extends EventEmitter implements ITaskService {
private getExecutionEngine(): ExecutionEngine {
let { config } = this.getConfiguration();
if (!config) {
- return ExecutionEngine.Terminal;
+ return ExecutionEngine.Process;
}
return TaskConfig.ExecutionEngine.from(config);
}