@@ -311,7 +311,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
311311 */
312312 private fetchExtensionRecommendationContents ( ) : Promise < { contents : IExtensionsConfigContent , source : ExtensionRecommendationSource } [ ] > {
313313 const workspace = this . contextService . getWorkspace ( ) ;
314- return Promise . all < { contents : IExtensionsConfigContent , source : ExtensionRecommendationSource } > ( [
314+ return Promise . all < { contents : IExtensionsConfigContent , source : ExtensionRecommendationSource } | null > ( [
315315 this . resolveWorkspaceExtensionConfig ( workspace ) . then ( contents => contents ? { contents, source : workspace } : null ) ,
316316 ...workspace . folders . map ( workspaceFolder => this . resolveWorkspaceFolderExtensionConfig ( workspaceFolder ) . then ( contents => contents ? { contents, source : workspaceFolder } : null ) )
317317 ] ) . then ( contents => coalesce ( contents ) ) ;
@@ -638,7 +638,11 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
638638 return ;
639639 }
640640 const id = recommendationsToSuggest [ 0 ] ;
641- const name = caseInsensitiveGet ( product . extensionImportantTips , id ) [ 'name' ] ;
641+ const entry = caseInsensitiveGet ( product . extensionImportantTips , id ) ;
642+ if ( ! entry ) {
643+ return ;
644+ }
645+ const name = entry [ 'name' ] ;
642646
643647 // Indicates we have a suggested extension via the whitelist
644648 hasSuggestion = true ;
@@ -842,7 +846,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
842846 }
843847
844848 private fetchProactiveRecommendations ( calledDuringStartup ?: boolean ) : Promise < void > {
845- let fetchPromise = Promise . resolve ( null ) ;
849+ let fetchPromise = Promise . resolve ( undefined ) ;
846850 if ( ! this . proactiveRecommendationsFetched ) {
847851 this . proactiveRecommendationsFetched = true ;
848852
@@ -893,10 +897,10 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
893897 if ( ! windowsPath || typeof windowsPath !== 'string' ) {
894898 return ;
895899 }
896- windowsPath = windowsPath . replace ( '%USERPROFILE%' , process . env [ 'USERPROFILE' ] )
897- . replace ( '%ProgramFiles(x86)%' , process . env [ 'ProgramFiles(x86)' ] )
898- . replace ( '%ProgramFiles%' , process . env [ 'ProgramFiles' ] )
899- . replace ( '%APPDATA%' , process . env [ 'APPDATA' ] ) ;
900+ windowsPath = windowsPath . replace ( '%USERPROFILE%' , process . env [ 'USERPROFILE' ] ! )
901+ . replace ( '%ProgramFiles(x86)%' , process . env [ 'ProgramFiles(x86)' ] ! )
902+ . replace ( '%ProgramFiles%' , process . env [ 'ProgramFiles' ] ! )
903+ . replace ( '%APPDATA%' , process . env [ 'APPDATA' ] ! ) ;
900904 promises . push ( findExecutable ( exeName , windowsPath ) ) ;
901905 } else {
902906 promises . push ( findExecutable ( exeName , paths . join ( '/usr/local/bin' , exeName ) ) ) ;
@@ -954,14 +958,17 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
954958 return Promise . all ( [ getHashedRemotesFromUri ( workspaceUri , this . fileService , false ) , getHashedRemotesFromUri ( workspaceUri , this . fileService , true ) ] ) . then ( ( [ hashedRemotes1 , hashedRemotes2 ] ) => {
955959 const hashedRemotes = ( hashedRemotes1 || [ ] ) . concat ( hashedRemotes2 || [ ] ) ;
956960 if ( ! hashedRemotes . length ) {
957- return null ;
961+ return undefined ;
958962 }
959963
960964 return this . requestService . request ( { type : 'GET' , url : this . _extensionsRecommendationsUrl } , CancellationToken . None ) . then ( context => {
961965 if ( context . res . statusCode !== 200 ) {
962- return Promise . resolve ( null ) ;
966+ return Promise . resolve ( undefined ) ;
963967 }
964968 return asJson ( context ) . then ( ( result ) => {
969+ if ( ! result ) {
970+ return ;
971+ }
965972 const allRecommendations : IDynamicWorkspaceRecommendations [ ] = Array . isArray ( result [ 'workspaceRecommendations' ] ) ? result [ 'workspaceRecommendations' ] : [ ] ;
966973 if ( ! allRecommendations . length ) {
967974 return ;
@@ -998,9 +1005,10 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
9981005 private fetchExperimentalRecommendations ( ) {
9991006 this . experimentService . getExperimentsByType ( ExperimentActionType . AddToRecommendations ) . then ( experiments => {
10001007 ( experiments || [ ] ) . forEach ( experiment => {
1001- if ( experiment . state === ExperimentState . Run && experiment . action . properties && Array . isArray ( experiment . action . properties . recommendations ) && experiment . action . properties . recommendationReason ) {
1002- experiment . action . properties . recommendations . forEach ( id => {
1003- this . _experimentalRecommendations [ id ] = experiment . action . properties . recommendationReason ;
1008+ const action = experiment . action ;
1009+ if ( action && experiment . state === ExperimentState . Run && action . properties && Array . isArray ( action . properties . recommendations ) && action . properties . recommendationReason ) {
1010+ action . properties . recommendations . forEach ( id => {
1011+ this . _experimentalRecommendations [ id ] = action . properties . recommendationReason ;
10041012 } ) ;
10051013 }
10061014 } ) ;
0 commit comments