@@ -9,7 +9,7 @@ import { generateRHDAReport } from './rhda';
99import { globalConfig } from './config' ;
1010import { StatusMessages , PromptText } from './constants' ;
1111import { caStatusBarProvider } from './caStatusBarProvider' ;
12- import { CANotification } from './caNotification' ;
12+ import { CANotification , CANotificationData } from './caNotification' ;
1313import { DepOutputChannel } from './depOutputChannel' ;
1414import { record , startUp , TelemetryActions } from './redhatTelemetry' ;
1515import { applySettingNameMappings , buildErrorMessage } from './utils' ;
@@ -27,6 +27,7 @@ export const notifications = new EventEmitter();
2727 */
2828export async function activate ( context : vscode . ExtensionContext ) {
2929 outputChannelDep = new DepOutputChannel ( ) ;
30+ outputChannelDep . info ( `starting RHDA extension ${ context . extension . packageJSON [ 'version' ] } ` ) ;
3031
3132 globalConfig . linkToSecretStorage ( context ) ;
3233
@@ -40,10 +41,11 @@ export async function activate(context: vscode.ExtensionContext) {
4041
4142 const fileHandler = new AnalysisMatcher ( ) ;
4243 context . subscriptions . push ( vscode . workspace . onDidSaveTextDocument ( ( doc ) => fileHandler . handle ( doc ) ) ) ;
44+ // Anecdotaly, some extension(s) may cause did-open events for files that aren't actually open in the editor,
45+ // so this will trigger CA for files not actually open.
4346 context . subscriptions . push ( vscode . workspace . onDidOpenTextDocument ( ( doc ) => fileHandler . handle ( doc ) ) ) ;
4447 context . subscriptions . push ( vscode . workspace . onDidCloseTextDocument ( doc => clearCodeActionsMap ( doc . uri ) ) ) ;
45- // iterate all open docs, as theres no "did open doc" event for these
46- // TODO: why is pom.xml not being picked up as background file
48+ // Iterate all open docs, as there is (in general) no did-open event for these.
4749 for ( const doc of vscode . workspace . textDocuments ) {
4850 fileHandler . handle ( doc ) ;
4951 }
@@ -111,7 +113,7 @@ export async function activate(context: vscode.ExtensionContext) {
111113 }
112114 } ;
113115
114- notifications . on ( 'caNotification' , respData => {
116+ notifications . on ( 'caNotification' , ( respData : CANotificationData ) => {
115117 const notification = new CANotification ( respData ) ;
116118 caStatusBarProvider . showSummary ( notification . statusText ( ) , notification . origin ( ) ) ;
117119 if ( notification . hasWarning ( ) ) {
@@ -120,12 +122,12 @@ export async function activate(context: vscode.ExtensionContext) {
120122 }
121123 } ) ;
122124
123- notifications . on ( 'caError' , errorData => {
125+ notifications . on ( 'caError' , ( errorData : CANotificationData ) => {
124126 const notification = new CANotification ( errorData ) ;
125127 caStatusBarProvider . setError ( ) ;
126128
127129 // Since CA is an automated feature, only warning message will be shown on failure
128- vscode . window . showWarningMessage ( notification . errorMsg ( ) ) ;
130+ vscode . window . showWarningMessage ( `RHDA error while analyzing ${ errorData . uri . fsPath } : ${ notification . errorMsg ( ) } ` ) ;
129131
130132 // Record telemetry event
131133 record ( context , TelemetryActions . componentAnalysisFailed , { manifest : path . basename ( notification . origin ( ) . fsPath ) , fileName : path . basename ( notification . origin ( ) . fsPath ) , error : notification . errorMsg ( ) } ) ;
0 commit comments