@@ -105,10 +105,13 @@ export async function activate(context: vscode.ExtensionContext) {
105105
106106 const showVulnerabilityFoundPrompt = async ( msg : string , filePath : vscode . Uri ) => {
107107 const fileName = path . basename ( filePath . fsPath ) ;
108- const selection = await vscode . window . showWarningMessage ( `${ msg } ` , PromptText . FULL_STACK_PROMPT_TEXT ) ;
108+ const selection = await vscode . window . showWarningMessage ( `${ msg } ` , PromptText . FULL_STACK_PROMPT_TEXT as string , PromptText . IGNORE_FILE ) ;
109109 if ( selection === PromptText . FULL_STACK_PROMPT_TEXT ) {
110110 record ( context , TelemetryActions . vulnerabilityReportPopupOpened , { manifest : fileName , fileName : fileName } ) ;
111111 vscode . commands . executeCommand ( commands . STACK_ANALYSIS_COMMAND , filePath . fsPath ) ;
112+ } else if ( selection === PromptText . IGNORE_FILE ) {
113+ outputChannelDep . info ( `Added "${ filePath . fsPath } " to workspace exclude list` ) ;
114+ await globalConfig . addFileToExcludeList ( filePath . fsPath ) ;
112115 } else {
113116 record ( context , TelemetryActions . vulnerabilityReportPopupIgnored , { manifest : fileName , fileName : fileName } ) ;
114117 }
@@ -123,12 +126,16 @@ export async function activate(context: vscode.ExtensionContext) {
123126 }
124127 } ) ;
125128
126- notifications . on ( 'caError' , ( errorData : CANotificationData ) => {
129+ notifications . on ( 'caError' , async ( errorData : CANotificationData ) => {
127130 const notification = new CANotification ( errorData ) ;
128131 caStatusBarProvider . setError ( ) ;
129132
130133 // Since CA is an automated feature, only warning message will be shown on failure
131- vscode . window . showWarningMessage ( `RHDA error while analyzing ${ errorData . uri . fsPath } : ${ notification . errorMsg ( ) } ` ) ;
134+ const selection = await vscode . window . showWarningMessage ( `RHDA error while analyzing ${ errorData . uri . fsPath } : ${ notification . errorMsg ( ) } ` , PromptText . IGNORE_FILE ) ;
135+ if ( selection === PromptText . IGNORE_FILE ) {
136+ outputChannelDep . info ( `Added "${ errorData . uri . fsPath } " to workspace exclude list` ) ;
137+ await globalConfig . addFileToExcludeList ( errorData . uri . fsPath ) ;
138+ }
132139
133140 // Record telemetry event
134141 record ( context , TelemetryActions . componentAnalysisFailed , { manifest : path . basename ( notification . origin ( ) . fsPath ) , fileName : path . basename ( notification . origin ( ) . fsPath ) , error : notification . errorMsg ( ) } ) ;
@@ -151,6 +158,7 @@ export async function activate(context: vscode.ExtensionContext) {
151158
152159 vscode . workspace . onDidChangeConfiguration ( ( ) => {
153160 globalConfig . loadData ( ) ;
161+ outputChannelDep . debug ( `configuration updated` ) ;
154162 } ) ;
155163}
156164
@@ -221,7 +229,12 @@ function registerStackAnalysisCommands(context: vscode.ExtensionContext) {
221229 record ( context , TelemetryActions . vulnerabilityReportDone , { manifest : fileName , fileName : fileName } ) ;
222230 } catch ( error ) {
223231 const message = applySettingNameMappings ( ( error as Error ) . message ) ;
224- vscode . window . showErrorMessage ( `RHDA error while analyzing ${ filePath } : ${ message } ` ) ;
232+ const selection = await vscode . window . showErrorMessage ( `RHDA error while analyzing ${ filePath } : ${ message } ` , PromptText . IGNORE_FILE ) ;
233+ if ( selection === PromptText . IGNORE_FILE ) {
234+ outputChannelDep . info ( `Added "${ filePath } " to workspace exclude list` ) ;
235+ await globalConfig . addFileToExcludeList ( filePath ) ;
236+ }
237+
225238 outputChannelDep . error ( buildLogErrorMessage ( ( error as Error ) ) ) ;
226239 record ( context , TelemetryActions . vulnerabilityReportFailed , { manifest : fileName , fileName : fileName , error : message } ) ;
227240 }
0 commit comments