mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
Addresses #27672: Task Detection For Gulp
This commit is contained in:
parent
41463b1b56
commit
19aecfd367
|
@ -73,6 +73,14 @@ function exec(command: string, options: cp.ExecOptions): Promise<{ stdout: strin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _channel: vscode.OutputChannel;
|
||||||
|
function getOutputChannel(): vscode.OutputChannel {
|
||||||
|
if (!_channel) {
|
||||||
|
_channel = vscode.window.createOutputChannel('Grunt Auto Detection');
|
||||||
|
}
|
||||||
|
return _channel;
|
||||||
|
}
|
||||||
|
|
||||||
async function getGruntTasks(): Promise<vscode.Task[]> {
|
async function getGruntTasks(): Promise<vscode.Task[]> {
|
||||||
let workspaceRoot = vscode.workspace.rootPath;
|
let workspaceRoot = vscode.workspace.rootPath;
|
||||||
let emptyTasks: vscode.Task[] = [];
|
let emptyTasks: vscode.Task[] = [];
|
||||||
|
@ -95,12 +103,11 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let commandLine = `${command} --help --no-color`;
|
let commandLine = `${command} --help --no-color`;
|
||||||
let channel = vscode.window.createOutputChannel('tasks');
|
|
||||||
try {
|
try {
|
||||||
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
channel.appendLine(stderr);
|
getOutputChannel().appendLine(stderr);
|
||||||
channel.show(true);
|
getOutputChannel().show(true);
|
||||||
}
|
}
|
||||||
let result: vscode.Task[] = [];
|
let result: vscode.Task[] = [];
|
||||||
if (stdout) {
|
if (stdout) {
|
||||||
|
@ -166,11 +173,15 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
let channel = getOutputChannel();
|
||||||
if (err.stderr) {
|
if (err.stderr) {
|
||||||
channel.appendLine(err.stderr);
|
channel.appendLine(err.stderr);
|
||||||
channel.show(true);
|
}
|
||||||
|
if (err.stdout) {
|
||||||
|
channel.appendLine(err.stdout);
|
||||||
}
|
}
|
||||||
channel.appendLine(localize('execFailed', 'Auto detecting Grunt failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
channel.appendLine(localize('execFailed', 'Auto detecting Grunt failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
||||||
|
channel.show(true);
|
||||||
return emptyTasks;
|
return emptyTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -73,6 +73,14 @@ function exec(command: string, options: cp.ExecOptions): Promise<{ stdout: strin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _channel: vscode.OutputChannel;
|
||||||
|
function getOutputChannel(): vscode.OutputChannel {
|
||||||
|
if (!_channel) {
|
||||||
|
_channel = vscode.window.createOutputChannel('Gulp Auto Detection');
|
||||||
|
}
|
||||||
|
return _channel;
|
||||||
|
}
|
||||||
|
|
||||||
async function getGulpTasks(): Promise<vscode.Task[]> {
|
async function getGulpTasks(): Promise<vscode.Task[]> {
|
||||||
let workspaceRoot = vscode.workspace.rootPath;
|
let workspaceRoot = vscode.workspace.rootPath;
|
||||||
let emptyTasks: vscode.Task[] = [];
|
let emptyTasks: vscode.Task[] = [];
|
||||||
|
@ -98,12 +106,11 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let commandLine = `${gulpCommand} --tasks-simple --no-color`;
|
let commandLine = `${gulpCommand} --tasks-simple --no-color`;
|
||||||
let channel = vscode.window.createOutputChannel('tasks');
|
|
||||||
try {
|
try {
|
||||||
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
||||||
if (stderr) {
|
if (stderr && stderr.length > 0) {
|
||||||
channel.appendLine(stderr);
|
getOutputChannel().appendLine(stderr);
|
||||||
channel.show(true);
|
getOutputChannel().show(true);
|
||||||
}
|
}
|
||||||
let result: vscode.Task[] = [];
|
let result: vscode.Task[] = [];
|
||||||
if (stdout) {
|
if (stdout) {
|
||||||
|
@ -137,10 +144,15 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
let channel = getOutputChannel();
|
||||||
if (err.stderr) {
|
if (err.stderr) {
|
||||||
channel.appendLine(err.stderr);
|
channel.appendLine(err.stderr);
|
||||||
}
|
}
|
||||||
|
if (err.stdout) {
|
||||||
|
channel.appendLine(err.stdout);
|
||||||
|
}
|
||||||
channel.appendLine(localize('execFailed', 'Auto detecting gulp failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
channel.appendLine(localize('execFailed', 'Auto detecting gulp failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
||||||
|
channel.show(true);
|
||||||
return emptyTasks;
|
return emptyTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -73,6 +73,14 @@ function exec(command: string, options: cp.ExecOptions): Promise<{ stdout: strin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _channel: vscode.OutputChannel;
|
||||||
|
function getOutputChannel(): vscode.OutputChannel {
|
||||||
|
if (!_channel) {
|
||||||
|
_channel = vscode.window.createOutputChannel('Jake Auto Detection');
|
||||||
|
}
|
||||||
|
return _channel;
|
||||||
|
}
|
||||||
|
|
||||||
async function getJakeTasks(): Promise<vscode.Task[]> {
|
async function getJakeTasks(): Promise<vscode.Task[]> {
|
||||||
let workspaceRoot = vscode.workspace.rootPath;
|
let workspaceRoot = vscode.workspace.rootPath;
|
||||||
let emptyTasks: vscode.Task[] = [];
|
let emptyTasks: vscode.Task[] = [];
|
||||||
|
@ -98,12 +106,11 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let commandLine = `${jakeCommand} --tasks`;
|
let commandLine = `${jakeCommand} --tasks`;
|
||||||
let channel = vscode.window.createOutputChannel('tasks');
|
|
||||||
try {
|
try {
|
||||||
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
channel.appendLine(stderr);
|
getOutputChannel().appendLine(stderr);
|
||||||
channel.show(true);
|
getOutputChannel().show(true);
|
||||||
}
|
}
|
||||||
let result: vscode.Task[] = [];
|
let result: vscode.Task[] = [];
|
||||||
if (stdout) {
|
if (stdout) {
|
||||||
|
@ -142,10 +149,15 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
let channel = getOutputChannel();
|
||||||
if (err.stderr) {
|
if (err.stderr) {
|
||||||
channel.appendLine(err.stderr);
|
channel.appendLine(err.stderr);
|
||||||
}
|
}
|
||||||
|
if (err.stdout) {
|
||||||
|
channel.appendLine(err.stdout);
|
||||||
|
}
|
||||||
channel.appendLine(localize('execFailed', 'Auto detecting Jake failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
channel.appendLine(localize('execFailed', 'Auto detecting Jake failed with error: {0}', err.error ? err.error.toString() : 'unknown'));
|
||||||
|
channel.show(true);
|
||||||
return emptyTasks;
|
return emptyTasks;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue