@@ -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
@@ -213,8 +221,11 @@ function showRHRepositoryRecommendationNotification() {
213221 * @param context - The extension context.
214222 */
215223function registerStackAnalysisCommands ( context : vscode . ExtensionContext ) {
216-
217- const invokeFullStackReport = async ( filePath : string ) => {
224+ const recordAndInvoke = async ( origin : string , uri : vscode . Uri ) => {
225+ // TODO: vscode.window.activeTextEditor may be null
226+ const fileUri = uri || vscode . window . activeTextEditor ! . document . uri ;
227+ const filePath = fileUri . fsPath ;
228+ record ( context , origin , { manifest : path . basename ( filePath ) , fileName : path . basename ( filePath ) } ) ;
218229 const fileName = path . basename ( filePath ) ;
219230 try {
220231 await generateRHDAReport ( context , filePath , outputChannelDep ) ;
@@ -227,14 +238,6 @@ function registerStackAnalysisCommands(context: vscode.ExtensionContext) {
227238 }
228239 } ;
229240
230- const recordAndInvoke = ( origin : string , uri : vscode . Uri ) => {
231- // TODO: vscode.window.activeTextEditor may be null
232- const fileUri = uri || vscode . window . activeTextEditor ! . document . uri ;
233- const filePath = fileUri . fsPath ;
234- record ( context , origin , { manifest : path . basename ( filePath ) , fileName : path . basename ( filePath ) } ) ;
235- invokeFullStackReport ( filePath ) ;
236- } ;
237-
238241 const registerCommand = ( cmd : string , action : TelemetryActions ) => {
239242 return vscode . commands . registerCommand ( cmd , recordAndInvoke . bind ( null , action ) ) ;
240243 } ;
0 commit comments