Skip to content

Task terminal icon has color glitch #249580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ITaskService, Task } from '../common/taskService.js';
import { ITerminalInstance } from '../../terminal/browser/terminal.js';
import { MarkerSeverity } from '../../../../platform/markers/common/markers.js';
import { spinningLoading } from '../../../../platform/theme/common/iconRegistry.js';
import { problemsErrorIconForeground, problemsWarningIconForeground } from '../../../../platform/theme/common/colorRegistry.js';
import { IMarker } from '../../../../platform/terminal/common/capabilities/capabilities.js';
import { AccessibilitySignal, IAccessibilitySignalService } from '../../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';
import { ITerminalStatus } from '../../terminal/common/terminal.js';
Expand All @@ -30,10 +31,10 @@ const TASK_TERMINAL_STATUS_ID = 'task_terminal_status';
export const ACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: spinningLoading, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.active', "Task is running") };
export const SUCCEEDED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.check, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.succeeded', "Task succeeded") };
const SUCCEEDED_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.check, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.succeededInactive', "Task succeeded and waiting...") };
export const FAILED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Error, tooltip: nls.localize('taskTerminalStatus.errors', "Task has errors") };
const FAILED_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Error, tooltip: nls.localize('taskTerminalStatus.errorsInactive', "Task has errors and is waiting...") };
const WARNING_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.warning, severity: Severity.Warning, tooltip: nls.localize('taskTerminalStatus.warnings', "Task has warnings") };
const WARNING_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.warning, severity: Severity.Warning, tooltip: nls.localize('taskTerminalStatus.warningsInactive', "Task has warnings and is waiting...") };
export const FAILED_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: { ...Codicon.error, color: { id: problemsErrorIconForeground } }, severity: Severity.Error, tooltip: nls.localize('taskTerminalStatus.errors', "Task has errors") };
const FAILED_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: { ...Codicon.error, color: { id: problemsErrorIconForeground } }, severity: Severity.Error, tooltip: nls.localize('taskTerminalStatus.errorsInactive', "Task has errors and is waiting...") };
const WARNING_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: { ...Codicon.warning, color: { id: problemsWarningIconForeground } }, severity: Severity.Warning, tooltip: nls.localize('taskTerminalStatus.warnings', "Task has warnings") };
const WARNING_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: { ...Codicon.warning, color: { id: problemsWarningIconForeground } }, severity: Severity.Warning, tooltip: nls.localize('taskTerminalStatus.warningsInactive', "Task has warnings and is waiting...") };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think these had effect, but the terminalData.terminal.changeColor?.(problemsErrorIconForeground, true); was what allowed me to really change the color of the icon.

Trying to figure out how I can change the red -> white on user focusing the failed terminal tab.
It seems like it does for the other x icon and the terminal title itself.

const INFO_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.infos', "Task has infos") };
const INFO_INACTIVE_TASK_STATUS: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: nls.localize('taskTerminalStatus.infosInactive', "Task has infos and is waiting...") };

Expand Down Expand Up @@ -106,8 +107,14 @@ export class TaskTerminalStatus extends Disposable {
} else if (event.exitCode || (terminalData.problemMatcher.maxMarkerSeverity !== undefined && terminalData.problemMatcher.maxMarkerSeverity >= MarkerSeverity.Warning)) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.taskFailed);
terminalData.terminal.statusList.add(FAILED_TASK_STATUS);
if (terminalData.terminal.hasFocus) {
terminalData.terminal.changeColor?.(problemsErrorIconForeground, true); // works but stays red even when focused/hover
}
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
terminalData.terminal.statusList.add(WARNING_TASK_STATUS);
if (terminalData.terminal.hasFocus) {
terminalData.terminal.changeColor?.(problemsWarningIconForeground, true); // works but stays red even when focused/hover
}
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Info) {
terminalData.terminal.statusList.add(INFO_TASK_STATUS);
}
Expand All @@ -125,8 +132,16 @@ export class TaskTerminalStatus extends Disposable {
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Error) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.taskFailed);
terminalData.terminal.statusList.add(FAILED_INACTIVE_TASK_STATUS);
terminalData.terminal.changeColor?.(problemsErrorIconForeground, true); // works but stays red even when focused/hover
Copy link
Preview

Copilot AI May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling changeColor here without a corresponding revert or reset means the icon may never return to its default color. Introduce logic on blur/unhover or theme change to restore the original color.

Suggested change
terminalData.terminal.changeColor?.(problemsErrorIconForeground, true); // works but stays red even when focused/hover
terminalData.terminal.changeColor?.(problemsErrorIconForeground, true); // works but stays red even when focused/hover
terminalData.terminal.onBlur(() => terminalData.terminal.resetColor?.());
terminalData.terminal.onUnhover(() => terminalData.terminal.resetColor?.());

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completely irrelevant. terminalData.terminal.onUnhover(() => terminalData.terminal.resetColor?.()); doesnt exist in real life

// if (terminalData.terminal.hasFocus) { // this doesnt work
// terminalData.terminal.changeColor?.(problemsErrorIconForeground, true);
// }
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
terminalData.terminal.statusList.add(WARNING_INACTIVE_TASK_STATUS);
terminalData.terminal.changeColor?.(problemsWarningIconForeground, true); // works but stays red even when focused/hover
// if (terminalData.terminal.hasFocus) { // this doesnt work
// terminalData.terminal.changeColor?.(problemsErrorIconForeground, true);
// }
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Info) {
terminalData.terminal.statusList.add(INFO_INACTIVE_TASK_STATUS);
}
Expand Down
Loading