Incorporate task terminal status feedback
This commit is contained in:
parent
67133f048d
commit
b540874d21
2 changed files with 10 additions and 8 deletions
|
@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
|
|||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { AbstractProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
||||
import { AbstractProblemCollector, StartStopProblemCollector } from 'vs/workbench/contrib/tasks/common/problemCollectors';
|
||||
import { TaskEvent, TaskEventKind } from 'vs/workbench/contrib/tasks/common/tasks';
|
||||
import { ITaskService, Task } from 'vs/workbench/contrib/tasks/common/taskService';
|
||||
import { ITerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
|
@ -22,7 +22,7 @@ interface TerminalData {
|
|||
const TASK_TERMINAL_STATUS_ID = 'task_terminal_status';
|
||||
const ACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.play, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.active', "Task is running") };
|
||||
const SUCCEEDED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.check, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.succeeded', "Task succeeded") };
|
||||
const FAILED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Warning, tooltip: nls.localize('taskTerminalStatus.errors', "Task has errors") };
|
||||
const FAILED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Error, tooltip: nls.localize('taskTerminalStatus.errors', "Task has errors") };
|
||||
|
||||
export class TaskTerminalStatus extends Disposable {
|
||||
private terminalMap: Map<Task, TerminalData> = new Map();
|
||||
|
@ -31,7 +31,7 @@ export class TaskTerminalStatus extends Disposable {
|
|||
super();
|
||||
this._register(taskService.onDidStateChange((event) => {
|
||||
switch (event.kind) {
|
||||
case TaskEventKind.Start:
|
||||
case TaskEventKind.ProcessStarted:
|
||||
case TaskEventKind.Active: this.eventActive(event); break;
|
||||
case TaskEventKind.Inactive: this.eventInactive(event); break;
|
||||
case TaskEventKind.ProcessEnded: this.eventEnd(event); break;
|
||||
|
@ -71,7 +71,7 @@ export class TaskTerminalStatus extends Disposable {
|
|||
|
||||
private eventInactive(event: TaskEvent) {
|
||||
const terminalData = this.terminalFromEvent(event);
|
||||
if (!terminalData) {
|
||||
if (!terminalData || !terminalData.problemMatcher) {
|
||||
return;
|
||||
}
|
||||
terminalData.terminal.statusList.remove(terminalData.status);
|
||||
|
@ -87,7 +87,11 @@ export class TaskTerminalStatus extends Disposable {
|
|||
if (!terminalData) {
|
||||
return;
|
||||
}
|
||||
|
||||
terminalData.terminal.statusList.remove(terminalData.status);
|
||||
terminalData.terminal.statusList.add(ACTIVE_TASK_STATUS);
|
||||
// We don't want to show an infinite status for a background task that doesn't have a problem matcher.
|
||||
if ((terminalData.problemMatcher instanceof StartStopProblemCollector) || (terminalData.problemMatcher?.problemMatchers.length > 0)) {
|
||||
terminalData.terminal.statusList.add(ACTIVE_TASK_STATUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ export abstract class AbstractProblemCollector implements IDisposable {
|
|||
|
||||
protected _onDidStateChange: Emitter<ProblemCollectorEvent>;
|
||||
|
||||
constructor(problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) {
|
||||
constructor(public readonly problemMatchers: ProblemMatcher[], protected markerService: IMarkerService, protected modelService: IModelService, fileService?: IFileService) {
|
||||
this.matchers = Object.create(null);
|
||||
this.bufferLength = 1;
|
||||
problemMatchers.map(elem => createLineMatcher(elem, fileService)).forEach((matcher) => {
|
||||
|
@ -396,7 +396,6 @@ interface BackgroundPatterns {
|
|||
|
||||
export class WatchingProblemCollector extends AbstractProblemCollector implements IProblemMatcher {
|
||||
|
||||
private problemMatchers: ProblemMatcher[];
|
||||
private backgroundPatterns: BackgroundPatterns[];
|
||||
|
||||
// workaround for https://github.com/microsoft/vscode/issues/44018
|
||||
|
@ -410,7 +409,6 @@ export class WatchingProblemCollector extends AbstractProblemCollector implement
|
|||
|
||||
constructor(problemMatchers: ProblemMatcher[], markerService: IMarkerService, modelService: IModelService, fileService?: IFileService) {
|
||||
super(problemMatchers, markerService, modelService, fileService);
|
||||
this.problemMatchers = problemMatchers;
|
||||
this.resetCurrentResource();
|
||||
this.backgroundPatterns = [];
|
||||
this._activeBackgroundMatchers = new Set<string>();
|
||||
|
|
Loading…
Reference in a new issue