Skip to content

Commit

Permalink
Add warning/error reasons to the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Discookie committed May 2, 2024
1 parent fcd2fb7 commit cdd1df8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/editor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ export class ExecutorAlerts {
case ProcessStatusType.errored:
this.statusBarItem.text = '$(testing-error-icon) CodeChecker: analysis errored';

const logLocation = status.reason ? 'sidebar' : 'output log';

Editor.notificationHandler.showNotification(
NotificationType.error,
'CodeChecker finished with error - see logs for details'
`CodeChecker finished with error - see the ${logLocation} for details`
);
break;
default:
Expand Down
32 changes: 27 additions & 5 deletions src/editor/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ export class NotificationHandler {
};
};

const makeReason = (): (Command)[] => {
if (!status.reason) {
return [];
}

return [{
title: `Reason: ${status.reason}`,
command: 'codechecker.executor.showOutput',
tooltip: `Reason: ${status.reason}\nSee the output log for full details`
},
{
title: 'Show process logs',
command: 'codechecker.executor.showOutput'
}];
};

switch (status.type) {
case ProcessStatusType.queued: {
const newNotification = SidebarContainer.notificationView.addNotification(
Expand Down Expand Up @@ -148,7 +164,16 @@ export class NotificationHandler {
case ProcessStatusType.finished: {
notification!.update({
message: makeMessage('finished running'),
choices: []
choices: makeReason()
});
this.activeNotifications.delete(process.commandLine);

break;
}
case ProcessStatusType.warning: {
notification!.update({
message: makeMessage('finished with warnings'),
choices: makeReason()
});
this.activeNotifications.delete(process.commandLine);

Expand All @@ -157,10 +182,7 @@ export class NotificationHandler {
case ProcessStatusType.errored: {
notification!.update({
message: makeMessage('finished with errors'),
choices: [{
title: 'Show process logs',
command: 'codechecker.executor.showOutput'
}]
choices: makeReason()
});
this.activeNotifications.delete(process.commandLine);

Expand Down

0 comments on commit cdd1df8

Please sign in to comment.