1+ import { getModeForPath } from "cm/modelist" ;
12import notificationManager from "lib/notificationManager" ;
23import Path from "utils/Path" ;
34import Url from "utils/Url" ;
@@ -98,9 +99,9 @@ class LanguageModeRecommendations {
9899 }
99100
100101 this . pendingKeywords . add ( keyword ) ;
101- void this . showRecommendation ( keyword )
102- . then ( ( ) => {
103- this . notifiedKeywords . add ( keyword ) ;
102+ void this . showRecommendation ( keyword , filename )
103+ . then ( ( shown ) => {
104+ if ( shown ) this . notifiedKeywords . add ( keyword ) ;
104105 } )
105106 . catch ( ( error ) => {
106107 console . warn ( "Failed to show extension recommendation." , error ) ;
@@ -110,8 +111,12 @@ class LanguageModeRecommendations {
110111 } ) ;
111112 }
112113
113- async showRecommendation ( keyword ) {
114+ async showRecommendation ( keyword , filename ) {
114115 const hasPlugins = await this . getPluginAvailability ( keyword ) ;
116+ // If a plugin registered the mode while the lookup was pending, suppress
117+ // this stale recommendation and leave the keyword eligible for future checks.
118+ if ( ! hasPlainTextFallback ( getModeForPath ( filename ) , filename ) ) return false ;
119+
115120 const displayExt = `.${ keyword } ` ;
116121
117122 if ( hasPlugins ) {
@@ -135,7 +140,7 @@ class LanguageModeRecommendations {
135140 } ,
136141 ] ,
137142 } ) ;
138- return ;
143+ return true ;
139144 }
140145
141146 const issueUrl = getIssueUrl ( keyword ) ;
@@ -159,6 +164,7 @@ class LanguageModeRecommendations {
159164 } ,
160165 ] ,
161166 } ) ;
167+ return true ;
162168 }
163169}
164170
0 commit comments