提交 19aecfd3 编写于 作者: D Dirk Baeumer

Addresses #27672: Task Detection For Gulp

上级 41463b1b
......@@ -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[]> {
let workspaceRoot = vscode.workspace.rootPath;
let emptyTasks: vscode.Task[] = [];
......@@ -95,12 +103,11 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
}
let commandLine = `${command} --help --no-color`;
let channel = vscode.window.createOutputChannel('tasks');
try {
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
if (stderr) {
channel.appendLine(stderr);
channel.show(true);
getOutputChannel().appendLine(stderr);
getOutputChannel().show(true);
}
let result: vscode.Task[] = [];
if (stdout) {
......@@ -166,11 +173,15 @@ async function getGruntTasks(): Promise<vscode.Task[]> {
}
return result;
} catch (err) {
let channel = getOutputChannel();
if (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.show(true);
return emptyTasks;
}
}
\ No newline at end of file
......@@ -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[]> {
let workspaceRoot = vscode.workspace.rootPath;
let emptyTasks: vscode.Task[] = [];
......@@ -98,12 +106,11 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
}
let commandLine = `${gulpCommand} --tasks-simple --no-color`;
let channel = vscode.window.createOutputChannel('tasks');
try {
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
if (stderr) {
channel.appendLine(stderr);
channel.show(true);
if (stderr && stderr.length > 0) {
getOutputChannel().appendLine(stderr);
getOutputChannel().show(true);
}
let result: vscode.Task[] = [];
if (stdout) {
......@@ -137,10 +144,15 @@ async function getGulpTasks(): Promise<vscode.Task[]> {
}
return result;
} catch (err) {
let channel = getOutputChannel();
if (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.show(true);
return emptyTasks;
}
}
\ No newline at end of file
......@@ -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[]> {
let workspaceRoot = vscode.workspace.rootPath;
let emptyTasks: vscode.Task[] = [];
......@@ -98,12 +106,11 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
}
let commandLine = `${jakeCommand} --tasks`;
let channel = vscode.window.createOutputChannel('tasks');
try {
let { stdout, stderr } = await exec(commandLine, { cwd: workspaceRoot });
if (stderr) {
channel.appendLine(stderr);
channel.show(true);
getOutputChannel().appendLine(stderr);
getOutputChannel().show(true);
}
let result: vscode.Task[] = [];
if (stdout) {
......@@ -142,10 +149,15 @@ async function getJakeTasks(): Promise<vscode.Task[]> {
}
return result;
} catch (err) {
let channel = getOutputChannel();
if (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.show(true);
return emptyTasks;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册