mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Make tthe source attribute mandantory for tasks defined in extensions
This commit is contained in:
parent
3f36a65d73
commit
cf594ad817
|
@ -169,16 +169,17 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
|
|||
let regExp = /^\s*(\S.*\S) \S/g;
|
||||
let matches = regExp.exec(line);
|
||||
if (matches && matches.length === 2) {
|
||||
let taskName = matches[1];
|
||||
let name = matches[1];
|
||||
let kind: GruntTaskKind = {
|
||||
type: 'grunt',
|
||||
task: taskName
|
||||
task: name
|
||||
};
|
||||
let task = taskName.indexOf(' ') === -1
|
||||
? new vscode.Task(kind, taskName, new vscode.ShellExecution(`${command} ${taskName}`))
|
||||
: new vscode.Task(kind, taskName, new vscode.ShellExecution(`${command} "${taskName}"`));
|
||||
let source = 'grunt';
|
||||
let task = name.indexOf(' ') === -1
|
||||
? new vscode.Task(kind, name, source, new vscode.ShellExecution(`${command} ${name}`))
|
||||
: new vscode.Task(kind, name, source, new vscode.ShellExecution(`${command} "${name}"`));
|
||||
result.push(task);
|
||||
let lowerCaseTaskName = taskName.toLowerCase();
|
||||
let lowerCaseTaskName = name.toLowerCase();
|
||||
if (isBuildTask(lowerCaseTaskName)) {
|
||||
task.group = vscode.TaskGroup.Build;
|
||||
} else if (isTestTask(lowerCaseTaskName)) {
|
||||
|
|
|
@ -151,7 +151,7 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
|
|||
type: 'gulp',
|
||||
task: line
|
||||
};
|
||||
let task = new vscode.Task(kind, line, new vscode.ShellExecution(`${gulpCommand} ${line}`));
|
||||
let task = new vscode.Task(kind, line, 'gulp', new vscode.ShellExecution(`${gulpCommand} ${line}`));
|
||||
result.push(task);
|
||||
let lowerCaseLine = line.toLowerCase();
|
||||
if (isBuildTask(lowerCaseLine)) {
|
||||
|
|
|
@ -155,7 +155,7 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
|
|||
type: 'jake',
|
||||
task: taskName
|
||||
};
|
||||
let task = new vscode.Task(kind, taskName, new vscode.ShellExecution(`${jakeCommand} ${taskName}`));
|
||||
let task = new vscode.Task(kind, taskName, 'jake', new vscode.ShellExecution(`${jakeCommand} ${taskName}`));
|
||||
result.push(task);
|
||||
let lowerCaseLine = line.toLowerCase();
|
||||
if (isBuildTask(lowerCaseLine)) {
|
||||
|
|
|
@ -113,7 +113,7 @@ async function getNpmScriptsAsTasks(): Promise<vscode.Task[]> {
|
|||
type: 'npm',
|
||||
script: each
|
||||
};
|
||||
const task = new vscode.Task(kind, `run ${each}`, new vscode.ShellExecution(`npm run ${each}`));
|
||||
const task = new vscode.Task(kind, `run ${each}`, 'npm', new vscode.ShellExecution(`npm run ${each}`));
|
||||
const lowerCaseTaskName = each.toLowerCase();
|
||||
if (isBuildTask(lowerCaseTaskName)) {
|
||||
task.group = vscode.TaskGroup.Build;
|
||||
|
@ -123,7 +123,7 @@ async function getNpmScriptsAsTasks(): Promise<vscode.Task[]> {
|
|||
result.push(task);
|
||||
});
|
||||
// add some 'well known' npm tasks
|
||||
result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskKind, `install`, new vscode.ShellExecution(`npm install`)));
|
||||
result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskKind, `install`, 'npm', new vscode.ShellExecution(`npm install`)));
|
||||
return Promise.resolve(result);
|
||||
} catch (e) {
|
||||
return Promise.resolve(emptyTasks);
|
||||
|
|
|
@ -54,8 +54,7 @@ class TscTaskProvider implements vscode.TaskProvider {
|
|||
return projects.map(configFile => {
|
||||
const configFileName = path.relative(rootPath, configFile);
|
||||
const identifier: TypeScriptTaskIdentifier = { type: 'typescript', tsconfig: configFileName };
|
||||
const buildTask = new vscode.Task(identifier, `build ${configFileName}`, new vscode.ShellExecution(`${command} -p "${configFile}"`), '$tsc');
|
||||
buildTask.source = 'tsc';
|
||||
const buildTask = new vscode.Task(identifier, `build ${configFileName}`, 'tsc', new vscode.ShellExecution(`${command} -p "${configFile}"`), '$tsc');
|
||||
buildTask.group = vscode.TaskGroup.Build;
|
||||
return buildTask;
|
||||
});
|
||||
|
|
9
src/vs/vscode.proposed.d.ts
vendored
9
src/vs/vscode.proposed.d.ts
vendored
|
@ -250,29 +250,32 @@ declare module 'vscode' {
|
|||
*
|
||||
* @param kind The task kind as defined in the 'taskKinds' 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.
|
||||
*/
|
||||
constructor(kind: TaskKind, name: string);
|
||||
constructor(kind: TaskKind, name: string, source: string);
|
||||
|
||||
/**
|
||||
* Creates a new task.
|
||||
*
|
||||
* @param kind The task kind as defined in the 'taskKinds' 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.
|
||||
*/
|
||||
constructor(kind: TaskKind, name: string, execution: ProcessExecution | ShellExecution);
|
||||
constructor(kind: TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution);
|
||||
|
||||
/**
|
||||
* Creates a new task.
|
||||
*
|
||||
* @param kind The task kind as defined in the 'taskKinds' 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(kind: TaskKind, name: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
constructor(kind: TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
|
||||
/**
|
||||
* The task's kind.
|
||||
|
|
|
@ -1164,13 +1164,14 @@ export class Task implements vscode.Task {
|
|||
private _presentationOptions: vscode.TaskPresentationOptions;
|
||||
|
||||
|
||||
constructor(kind: vscode.TaskKind, name: string);
|
||||
constructor(kind: vscode.TaskKind, name: string, execution: ProcessExecution | ShellExecution);
|
||||
constructor(kind: vscode.TaskKind, name: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
constructor(kind: vscode.TaskKind, name: string, source: string);
|
||||
constructor(kind: vscode.TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution);
|
||||
constructor(kind: vscode.TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]);
|
||||
|
||||
constructor(kind: vscode.TaskKind, name: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]) {
|
||||
constructor(kind: vscode.TaskKind, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]) {
|
||||
this.kind = kind;
|
||||
this.name = name;
|
||||
this.source = source;
|
||||
this.execution = execution;
|
||||
if (typeof problemMatchers === 'string') {
|
||||
this._problemMatchers = [problemMatchers];
|
||||
|
|
Loading…
Reference in a new issue