Skip to content

Commit 2ef8e48

Browse files
committed
Implemented latest feedback from microsoft#28235
1 parent c9cf1f5 commit 2ef8e48

21 files changed

Lines changed: 1083 additions & 554 deletions

File tree

.vscode/tasks.json

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
{
2-
"version": "0.1.0",
3-
"windows": {
4-
"command": ".\\node_modules\\.bin\\gulp"
5-
},
6-
"osx": {
7-
"command": "./node_modules/.bin/gulp"
8-
},
9-
"linux": {
10-
"command": "./node_modules/.bin/gulp"
11-
},
12-
"isShellCommand": true,
2+
"version": "2.0.0",
133
"tasks": [
144
{
15-
"taskName": "watch",
16-
"args": [
17-
"--no-color"
18-
],
19-
"isBuildCommand": true,
5+
"customize": "vscode.npm.run watch",
6+
"taskName": "Build VS Code",
7+
"group": "build",
208
"isBackground": true,
9+
"terminal": {
10+
"reveal": "never"
11+
},
2112
"problemMatcher": {
2213
"owner": "typescript",
2314
"applyTo": "closedDocuments",
@@ -37,38 +28,34 @@
3728
}
3829
},
3930
{
40-
"taskName": "tslint",
41-
"args": [],
42-
"problemMatcher": {
43-
"owner": "tslint",
44-
"fileLocation": [
45-
"relative",
46-
"${workspaceRoot}"
47-
],
48-
"severity": "warning",
49-
"pattern": {
50-
"regexp": "(.*)\\[(\\d+),\\s(\\d+)\\]:\\s(.*)$", // (.*)\[(\d+), (\d+)\]: (.*)
51-
"file": 1,
52-
"line": 2,
53-
"column": 3,
54-
"message": 4
55-
}
31+
"customize": "gulp.tslint",
32+
"taskName": "Run tslint",
33+
"problemMatcher": ["$tslint4"]
34+
},
35+
{
36+
"taskName": "Run tests",
37+
"type": "shell",
38+
"command": "./scripts/test.sh",
39+
"windows": {
40+
"command": ".\\scripts\\test.bat"
41+
},
42+
"group": "test",
43+
"terminal": {
44+
"echo": true,
45+
"reveal": "always"
5646
}
5747
},
5848
{
59-
"taskName": "test",
60-
"args": [
61-
"--no-color"
62-
],
63-
"showOutput": "always",
64-
"isTestCommand": true
49+
"taskName": "Run Dev",
50+
"type": "shell",
51+
"command": "./scripts/code.sh",
52+
"windows": {
53+
"command": ".\\scripts\\code.bat"
54+
}
6555
},
6656
{
67-
"taskName": "electron",
68-
"args": [
69-
"--no-color"
70-
],
71-
"showOutput": "never"
57+
"customize": "gulp.electron",
58+
"taskName": "Download electron"
7259
}
7360
]
7461
}

extensions/grunt/package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@
4141
"description": "%config.grunt.autoDetect%"
4242
}
4343
}
44-
}
44+
},
45+
"taskTypes": [
46+
{
47+
"taskType": "grunt",
48+
"required": ["task"],
49+
"properties": {
50+
"task": {
51+
"type": "string",
52+
"description": "The Grunt task to customize"
53+
},
54+
"file": {
55+
"type": "string",
56+
"description": "The Grunt file that provides the task. Can be omitted."
57+
}
58+
}
59+
}
60+
]
4561
}
4662
}

extensions/grunt/src/main.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ function getOutputChannel(): vscode.OutputChannel {
8181
return _channel;
8282
}
8383

84+
interface GruntTaskIdentifier extends vscode.TaskIdentifier {
85+
task: string;
86+
file?: string;
87+
}
88+
8489
async function getGruntTasks(): Promise<vscode.Task[]> {
8590
let workspaceRoot = vscode.workspace.rootPath;
8691
let emptyTasks: vscode.Task[] = [];
@@ -145,10 +150,13 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
145150
let matches = regExp.exec(line);
146151
if (matches && matches.length === 2) {
147152
let taskName = matches[1];
153+
let identifier: GruntTaskIdentifier = {
154+
type: 'grunt',
155+
task: taskName
156+
};
148157
let task = taskName.indexOf(' ') === -1
149-
? new vscode.ShellTask(taskName, `${command} ${taskName}`)
150-
: new vscode.ShellTask(taskName, `${command} "${taskName}"`);
151-
task.identifier = `grunt.${taskName}`;
158+
? new vscode.ShellTask(identifier, taskName, `${command} ${taskName}`)
159+
: new vscode.ShellTask(identifier, taskName, `${command} "${taskName}"`);
152160
result.push(task);
153161
let lowerCaseTaskName = taskName.toLowerCase();
154162
if (lowerCaseTaskName === 'build') {

extensions/gulp/src/main.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ function getOutputChannel(): vscode.OutputChannel {
8181
return _channel;
8282
}
8383

84+
interface GulpTaskIdentifier extends vscode.TaskIdentifier {
85+
task: string;
86+
file?: string;
87+
}
88+
8489
async function getGulpTasks(): Promise<vscode.Task[]> {
8590
let workspaceRoot = vscode.workspace.rootPath;
8691
let emptyTasks: vscode.Task[] = [];
@@ -121,8 +126,11 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
121126
if (line.length === 0) {
122127
continue;
123128
}
124-
let task = new vscode.ShellTask(line, `${gulpCommand} ${line}`);
125-
task.identifier = `gulp.${line}`;
129+
let identifier: GulpTaskIdentifier = {
130+
type: 'gulp',
131+
task: line
132+
};
133+
let task = new vscode.ShellTask(identifier, line, `${gulpCommand} ${line}`);
126134
result.push(task);
127135
let lowerCaseLine = line.toLowerCase();
128136
if (lowerCaseLine === 'build') {

extensions/jake/package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@
4141
"description": "%config.jake.autoDetect%"
4242
}
4343
}
44-
}
44+
},
45+
"taskTypes": [
46+
{
47+
"taskType": "jake",
48+
"required": ["task"],
49+
"properties": {
50+
"task": {
51+
"type": "string",
52+
"description": "The Jake task to customize"
53+
},
54+
"file": {
55+
"type": "string",
56+
"description": "The Jake file that provides the task. Can be omitted."
57+
}
58+
}
59+
}
60+
]
4561
}
4662
}

extensions/jake/src/main.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ function getOutputChannel(): vscode.OutputChannel {
8181
return _channel;
8282
}
8383

84+
interface JakeTaskIdentifier extends vscode.TaskIdentifier {
85+
task: string;
86+
file?: string;
87+
}
88+
8489
async function getJakeTasks(): Promise<vscode.Task[]> {
8590
let workspaceRoot = vscode.workspace.rootPath;
8691
let emptyTasks: vscode.Task[] = [];
@@ -125,8 +130,11 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
125130
let matches = regExp.exec(line);
126131
if (matches && matches.length === 2) {
127132
let taskName = matches[1];
128-
let task = new vscode.ShellTask(taskName, `${jakeCommand} ${taskName}`);
129-
task.identifier = `jake.${taskName}`;
133+
let identifier: JakeTaskIdentifier = {
134+
type: 'jake',
135+
task: taskName
136+
};
137+
let task = new vscode.ShellTask(identifier, taskName, `${jakeCommand} ${taskName}`);
130138
result.push(task);
131139
let lowerCaseLine = line.toLowerCase();
132140
if (lowerCaseLine === 'build') {

extensions/npm/src/main.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ async function readFile(file: string): Promise<string> {
5959
});
6060
}
6161

62+
interface NpmTaskIdentifier extends vscode.TaskIdentifier {
63+
script: string;
64+
file?: string;
65+
}
66+
67+
6268
async function getNpmScriptsAsTasks(): Promise<vscode.Task[]> {
6369
let workspaceRoot = vscode.workspace.rootPath;
6470
let emptyTasks: vscode.Task[] = [];
@@ -81,7 +87,11 @@ async function getNpmScriptsAsTasks(): Promise<vscode.Task[]> {
8187

8288
const result: vscode.Task[] = [];
8389
Object.keys(json.scripts).forEach(each => {
84-
const task = new vscode.ShellTask(`run ${each}`, `npm run ${each}`);
90+
const identifier: NpmTaskIdentifier = {
91+
type: 'npm',
92+
script: each
93+
};
94+
const task = new vscode.ShellTask(identifier, `run ${each}`, `npm run ${each}`);
8595
const lowerCaseTaskName = each.toLowerCase();
8696
if (lowerCaseTaskName === 'build') {
8797
task.group = vscode.TaskGroup.Build;
@@ -91,7 +101,7 @@ async function getNpmScriptsAsTasks(): Promise<vscode.Task[]> {
91101
result.push(task);
92102
});
93103
// add some 'well known' npm tasks
94-
result.push(new vscode.ShellTask(`install`, `npm install`));
104+
result.push(new vscode.ShellTask({ type: 'npm', script: 'install' } as NpmTaskIdentifier, `install`, `npm install`));
95105
return Promise.resolve(result);
96106
} catch (e) {
97107
return Promise.resolve(emptyTasks);

extensions/typescript/src/features/taskProvider.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const exists = (file: string): Promise<boolean> =>
2121
});
2222
});
2323

24+
25+
interface TypeScriptTaskIdentifier extends vscode.TaskIdentifier {
26+
configFile: string;
27+
}
28+
2429
/**
2530
* Provides tasks for building `tsconfig.json` files in a project.
2631
*/
@@ -48,7 +53,8 @@ class TscTaskProvider implements vscode.TaskProvider {
4853

4954
return projects.map(configFile => {
5055
const configFileName = path.relative(rootPath, configFile);
51-
const buildTask = new vscode.ShellTask(`build ${configFileName}`, `${command} -p "${configFile}"`, '$tsc');
56+
const identifier: TypeScriptTaskIdentifier = { type: 'typescript', configFile: configFileName };
57+
const buildTask = new vscode.ShellTask(identifier, `build ${configFileName}`, `${command} -p "${configFile}"`, '$tsc');
5258
buildTask.source = 'tsc';
5359
buildTask.group = vscode.TaskGroup.Build;
5460
return buildTask;

0 commit comments

Comments
 (0)