Skip to content

Commit e3c1391

Browse files
committed
Add warning/error reasons to the sidebar
1 parent 5d1d5fb commit e3c1391

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

src/editor/executor.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ export class ExecutorAlerts {
112112
case ProcessStatusType.errored:
113113
this.statusBarItem.text = '$(testing-error-icon) CodeChecker: analysis errored';
114114

115+
const logLocation = status.reason ? 'sidebar' : 'output log';
116+
115117
Editor.notificationHandler.showNotification(
116118
NotificationType.error,
117-
'CodeChecker finished with error - see logs for details'
119+
`CodeChecker finished with error - see the ${logLocation} for details`
118120
);
119121
break;
120122
default:

src/editor/notifications.ts

+27-5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ export class NotificationHandler {
9999
};
100100
};
101101

102+
const makeReason = (): (Command)[] => {
103+
if (!status.reason) {
104+
return [];
105+
}
106+
107+
return [{
108+
title: `Reason: ${status.reason}`,
109+
command: 'codechecker.executor.showOutput',
110+
tooltip: `Reason: ${status.reason}\nSee the output log for full details`
111+
},
112+
{
113+
title: 'Show process logs',
114+
command: 'codechecker.executor.showOutput'
115+
}];
116+
};
117+
102118
switch (status.type) {
103119
case ProcessStatusType.queued: {
104120
const newNotification = SidebarContainer.notificationView.addNotification(
@@ -148,7 +164,16 @@ export class NotificationHandler {
148164
case ProcessStatusType.finished: {
149165
notification!.update({
150166
message: makeMessage('finished running'),
151-
choices: []
167+
choices: makeReason()
168+
});
169+
this.activeNotifications.delete(process.commandLine);
170+
171+
break;
172+
}
173+
case ProcessStatusType.warning: {
174+
notification!.update({
175+
message: makeMessage('finished with warnings'),
176+
choices: makeReason()
152177
});
153178
this.activeNotifications.delete(process.commandLine);
154179

@@ -157,10 +182,7 @@ export class NotificationHandler {
157182
case ProcessStatusType.errored: {
158183
notification!.update({
159184
message: makeMessage('finished with errors'),
160-
choices: [{
161-
title: 'Show process logs',
162-
command: 'codechecker.executor.showOutput'
163-
}]
185+
choices: makeReason()
164186
});
165187
this.activeNotifications.delete(process.commandLine);
166188

0 commit comments

Comments
 (0)