Skip to content

Commit c6ff2a6

Browse files
committed
Remove unclosable CodeChecker analysis in progress window
On large projects the analysis may take minutes. In this case it is really annyoing for the user to show an unclosable pop-window. Also this information whether an analysis is running is already available in the bottom bar. This patch will remove this pop-up window but will introduce a new tree item on the overview sidebar to stop the analysis.
1 parent ec43c23 commit c6ff2a6

File tree

3 files changed

+10
-48
lines changed

3 files changed

+10
-48
lines changed

src/backend/executor/process.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export enum ProcessType {
2121
export interface ProcessParameters {
2222
/** Default: true, false when type is parse */
2323
forwardStdoutToLogs?: boolean,
24-
/** Default: true, false when type is parse or version */
25-
showProgressBar?: boolean,
24+
2625
/**
2726
* Name of the process, preferred to be one of ProcessType.
2827
* Default: other
@@ -78,15 +77,10 @@ export class ScheduledProcess implements Disposable {
7877
this.processParameters = parameters;
7978

8079
const forwardDefaults: string[] = [ ProcessType.parse ];
81-
const progressDefaults: string[] = [ ProcessType.parse, ProcessType.version ];
8280

8381
if (this.processParameters.forwardStdoutToLogs === undefined) {
8482
this.processParameters.forwardStdoutToLogs = !forwardDefaults.includes(parameters.processType ?? '');
8583
}
86-
87-
if (this.processParameters.showProgressBar === undefined) {
88-
this.processParameters.showProgressBar = !progressDefaults.includes(parameters.processType ?? '');
89-
}
9084
}
9185

9286
dispose() {

src/editor/executor.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {
2-
CancellationTokenSource,
32
ExtensionContext,
4-
ProgressLocation,
53
StatusBarAlignment,
64
StatusBarItem,
75
commands,
@@ -12,7 +10,6 @@ import { ExtensionApi } from '../backend';
1210
import { ProcessStatus } from '../backend/executor/process';
1311

1412
export class ExecutorAlerts {
15-
private activeToken?: CancellationTokenSource;
1613
private statusBarItem: StatusBarItem;
1714
private enableProgress = true;
1815

@@ -43,16 +40,11 @@ export class ExecutorAlerts {
4340

4441
onStatusChange(status: ProcessStatus) {
4542
// Do not update when a non-progressbar process was finished
46-
if (ExtensionApi.executorManager.activeProcess !== undefined) {
47-
this.enableProgress = ExtensionApi.executorManager.activeProcess.processParameters.showProgressBar!;
48-
}
49-
50-
if (!this.enableProgress) {
43+
if (ExtensionApi.executorManager.activeProcess === undefined) {
5144
return;
5245
}
5346

5447
if (status === ProcessStatus.running) {
55-
this.showProgressbar('CodeChecker: analysis in progress...');
5648
this.statusBarItem.text = 'CodeChecker: analysis in progress...';
5749
this.statusBarItem.show();
5850
return;
@@ -76,38 +68,6 @@ export class ExecutorAlerts {
7668
break;
7769
}
7870

79-
this.hideProgressbar();
8071
this.statusBarItem.show();
8172
}
82-
83-
showProgressbar(message: string) {
84-
// Clear previous alert, and then create the new progress
85-
if (this.activeToken !== undefined) {
86-
this.activeToken.cancel();
87-
}
88-
89-
this.activeToken = new CancellationTokenSource();
90-
91-
window.withProgress(
92-
{ cancellable: true, location: ProgressLocation.Notification, title: message },
93-
async (_progress, cancelButton) => new Promise((res, _rej) => {
94-
this.activeToken?.token.onCancellationRequested(() => {
95-
res(null);
96-
});
97-
98-
cancelButton.onCancellationRequested(() => {
99-
// On Cancel button, kill the process
100-
ExtensionApi.executorBridge.stopAnalysis();
101-
res(null);
102-
});
103-
})
104-
);
105-
}
106-
107-
hideProgressbar() {
108-
if (this.activeToken !== undefined) {
109-
this.activeToken.cancel();
110-
this.activeToken = undefined;
111-
}
112-
}
11373
}

src/sidebar/views/overview.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ export class OverviewView implements TreeDataProvider<OverviewItem> {
106106
command: 'codechecker.executor.analyzeProject',
107107
}
108108
),
109+
new OverviewItem(
110+
'Stop analysis',
111+
'debug-stop',
112+
{
113+
title: 'stopAnalysis',
114+
command: 'codechecker.executor.stopAnalysis',
115+
}
116+
),
109117
],
110118
'ccNotFound': [
111119
new OverviewItem(

0 commit comments

Comments
 (0)