@@ -784,7 +784,7 @@ namespace ts.server {
784
784
public readonly pluginProbeLocations : readonly string [ ] ;
785
785
public readonly allowLocalPluginLoads : boolean ;
786
786
/*@internal */
787
- currentPluginConfigOverrides : ESMap < string , any > | undefined ;
787
+ private currentPluginConfigOverrides : ESMap < string , any > | undefined ;
788
788
789
789
public readonly typesMapLocation : string | undefined ;
790
790
@@ -2237,7 +2237,10 @@ namespace ts.server {
2237
2237
configFileExistenceInfo . config . watchedDirectoriesStale = true ;
2238
2238
configFileExistenceInfo . config . reloadLevel = undefined ;
2239
2239
}
2240
- if ( parsedCommandLine . watchOptions ) parsedCommandLine . watchOptions . watchFactorySearchPaths = ( ) => this . getProjectPluginSearchPaths ( canonicalConfigFilePath ) ;
2240
+ if ( parsedCommandLine . watchOptions ) {
2241
+ parsedCommandLine . watchOptions . watchFactorySearchPaths = ( ) => this . getProjectPluginSearchPaths ( canonicalConfigFilePath ) ;
2242
+ parsedCommandLine . watchOptions . watchFactoryWithConfigOverride = plugin => this . getPluginWithConfigOverride ( plugin ) ;
2243
+ }
2241
2244
2242
2245
// If watch options different than older options when setting for the first time, update the config file watcher
2243
2246
if ( ! oldCommandLine && ! isJsonEqual (
@@ -3053,6 +3056,7 @@ namespace ts.server {
3053
3056
if ( this . hostConfiguration . watchOptions ?. watchFactory ) {
3054
3057
// Set the watchFactory searchPaths same as global paths
3055
3058
this . hostConfiguration . watchOptions . watchFactorySearchPaths = ( ) => this . getGlobalPluginSearchPaths ( ) ;
3059
+ this . hostConfiguration . watchOptions . watchFactoryWithConfigOverride = plugin => this . getPluginWithConfigOverride ( plugin ) ;
3056
3060
}
3057
3061
this . projectWatchOptions . clear ( ) ;
3058
3062
this . logger . info ( `Host watch options changed to ${ JSON . stringify ( this . hostConfiguration . watchOptions ) } , it will be take effect for next watches.` ) ;
@@ -4132,6 +4136,18 @@ namespace ts.server {
4132
4136
return searchPaths ;
4133
4137
}
4134
4138
4139
+ /*@internal */
4140
+ getPluginWithConfigOverride ( pluginConfigEntry : PluginImport ) {
4141
+ const configurationOverride = this . currentPluginConfigOverrides ?. get ( pluginConfigEntry . name ) ;
4142
+ if ( configurationOverride ) {
4143
+ // Preserve the name property since it's immutable
4144
+ const pluginName = pluginConfigEntry . name ;
4145
+ pluginConfigEntry = configurationOverride ;
4146
+ pluginConfigEntry . name = pluginName ;
4147
+ }
4148
+ return pluginConfigEntry ;
4149
+ }
4150
+
4135
4151
/*@internal */
4136
4152
requestEnablePlugin ( project : Project , pluginConfigEntry : PluginImport , searchPaths : string [ ] ) {
4137
4153
if ( ! this . host . importPlugin && ! this . host . require ) {
0 commit comments