提交 edd216eb 编写于 作者: A Alex Ross

Gulp task detection shouldn't open output

Fixes #64900
上级 d13f20e0
...@@ -7,8 +7,8 @@ import * as path from 'path'; ...@@ -7,8 +7,8 @@ import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import * as cp from 'child_process'; import * as cp from 'child_process';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
type AutoDetect = 'on' | 'off'; type AutoDetect = 'on' | 'off';
...@@ -60,6 +60,13 @@ function getOutputChannel(): vscode.OutputChannel { ...@@ -60,6 +60,13 @@ function getOutputChannel(): vscode.OutputChannel {
return _channel; return _channel;
} }
function showError() {
vscode.window.showWarningMessage(localize('gulpTaskDetectError', 'Problem finding gulp tasks. See the output for more information.'),
localize('gulpShowOutput', 'Go to output')).then(() => {
_channel.show(true);
});
}
interface GulpTaskDefinition extends vscode.TaskDefinition { interface GulpTaskDefinition extends vscode.TaskDefinition {
task: string; task: string;
file?: string; file?: string;
...@@ -125,7 +132,7 @@ class FolderDetector { ...@@ -125,7 +132,7 @@ class FolderDetector {
let { stdout, stderr } = await exec(commandLine, { cwd: rootPath }); let { stdout, stderr } = await exec(commandLine, { cwd: rootPath });
if (stderr && stderr.length > 0) { if (stderr && stderr.length > 0) {
getOutputChannel().appendLine(stderr); getOutputChannel().appendLine(stderr);
getOutputChannel().show(true); showError();
} }
let result: vscode.Task[] = []; let result: vscode.Task[] = [];
if (stdout) { if (stdout) {
...@@ -159,7 +166,7 @@ class FolderDetector { ...@@ -159,7 +166,7 @@ class FolderDetector {
channel.appendLine(err.stdout); channel.appendLine(err.stdout);
} }
channel.appendLine(localize('execFailed', 'Auto detecting gulp for folder {0} failed with error: {1}', this.workspaceFolder.name, err.error ? err.error.toString() : 'unknown')); channel.appendLine(localize('execFailed', 'Auto detecting gulp for folder {0} failed with error: {1}', this.workspaceFolder.name, err.error ? err.error.toString() : 'unknown'));
channel.show(true); showError();
return emptyTasks; return emptyTasks;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册