From c6ff2a630963a8e50b01f2edd6fb50b417c77731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Csord=C3=A1s?= Date: Mon, 31 Jan 2022 09:45:10 +0100 Subject: [PATCH] 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. --- src/backend/executor/process.ts | 8 +------ src/editor/executor.ts | 42 +-------------------------------- src/sidebar/views/overview.ts | 8 +++++++ 3 files changed, 10 insertions(+), 48 deletions(-) diff --git a/src/backend/executor/process.ts b/src/backend/executor/process.ts index b1d1a27..d4c75e5 100644 --- a/src/backend/executor/process.ts +++ b/src/backend/executor/process.ts @@ -21,8 +21,7 @@ export enum ProcessType { export interface ProcessParameters { /** Default: true, false when type is parse */ forwardStdoutToLogs?: boolean, - /** Default: true, false when type is parse or version */ - showProgressBar?: boolean, + /** * Name of the process, preferred to be one of ProcessType. * Default: other @@ -78,15 +77,10 @@ export class ScheduledProcess implements Disposable { this.processParameters = parameters; const forwardDefaults: string[] = [ ProcessType.parse ]; - const progressDefaults: string[] = [ ProcessType.parse, ProcessType.version ]; if (this.processParameters.forwardStdoutToLogs === undefined) { this.processParameters.forwardStdoutToLogs = !forwardDefaults.includes(parameters.processType ?? ''); } - - if (this.processParameters.showProgressBar === undefined) { - this.processParameters.showProgressBar = !progressDefaults.includes(parameters.processType ?? ''); - } } dispose() { diff --git a/src/editor/executor.ts b/src/editor/executor.ts index 3ba70d9..4fb6a15 100644 --- a/src/editor/executor.ts +++ b/src/editor/executor.ts @@ -1,7 +1,5 @@ import { - CancellationTokenSource, ExtensionContext, - ProgressLocation, StatusBarAlignment, StatusBarItem, commands, @@ -12,7 +10,6 @@ import { ExtensionApi } from '../backend'; import { ProcessStatus } from '../backend/executor/process'; export class ExecutorAlerts { - private activeToken?: CancellationTokenSource; private statusBarItem: StatusBarItem; private enableProgress = true; @@ -43,16 +40,11 @@ export class ExecutorAlerts { onStatusChange(status: ProcessStatus) { // Do not update when a non-progressbar process was finished - if (ExtensionApi.executorManager.activeProcess !== undefined) { - this.enableProgress = ExtensionApi.executorManager.activeProcess.processParameters.showProgressBar!; - } - - if (!this.enableProgress) { + if (ExtensionApi.executorManager.activeProcess === undefined) { return; } if (status === ProcessStatus.running) { - this.showProgressbar('CodeChecker: analysis in progress...'); this.statusBarItem.text = 'CodeChecker: analysis in progress...'; this.statusBarItem.show(); return; @@ -76,38 +68,6 @@ export class ExecutorAlerts { break; } - this.hideProgressbar(); this.statusBarItem.show(); } - - showProgressbar(message: string) { - // Clear previous alert, and then create the new progress - if (this.activeToken !== undefined) { - this.activeToken.cancel(); - } - - this.activeToken = new CancellationTokenSource(); - - window.withProgress( - { cancellable: true, location: ProgressLocation.Notification, title: message }, - async (_progress, cancelButton) => new Promise((res, _rej) => { - this.activeToken?.token.onCancellationRequested(() => { - res(null); - }); - - cancelButton.onCancellationRequested(() => { - // On Cancel button, kill the process - ExtensionApi.executorBridge.stopAnalysis(); - res(null); - }); - }) - ); - } - - hideProgressbar() { - if (this.activeToken !== undefined) { - this.activeToken.cancel(); - this.activeToken = undefined; - } - } } \ No newline at end of file diff --git a/src/sidebar/views/overview.ts b/src/sidebar/views/overview.ts index 524f924..4070b8a 100644 --- a/src/sidebar/views/overview.ts +++ b/src/sidebar/views/overview.ts @@ -106,6 +106,14 @@ export class OverviewView implements TreeDataProvider { command: 'codechecker.executor.analyzeProject', } ), + new OverviewItem( + 'Stop analysis', + 'debug-stop', + { + title: 'stopAnalysis', + command: 'codechecker.executor.stopAnalysis', + } + ), ], 'ccNotFound': [ new OverviewItem(