@@ -999,16 +999,22 @@ namespace ts.server {
999999 if ( this . projectService . globalPlugins ) {
10001000 // Enable global plugins with synthetic configuration entries
10011001 for ( const globalPluginName of this . projectService . globalPlugins ) {
1002+ // Skip empty names from odd commandline parses
1003+ if ( ! globalPluginName ) continue ;
1004+
10021005 // Skip already-locally-loaded plugins
10031006 if ( options . plugins && options . plugins . some ( p => p . name === globalPluginName ) ) continue ;
10041007
10051008 // Provide global: true so plugins can detect why they can't find their config
1009+ this . projectService . logger . info ( `Loading global plugin ${ globalPluginName } ` ) ;
10061010 this . enablePlugin ( { name : globalPluginName , global : true } as PluginImport , searchPaths ) ;
10071011 }
10081012 }
10091013 }
10101014
10111015 private enablePlugin ( pluginConfigEntry : PluginImport , searchPaths : string [ ] ) {
1016+ this . projectService . logger . info ( `Enabling plugin ${ pluginConfigEntry . name } from candidate paths: ${ searchPaths . join ( "," ) } ` ) ;
1017+
10121018 const log = ( message : string ) => {
10131019 this . projectService . logger . info ( message ) ;
10141020 } ;
@@ -1020,7 +1026,7 @@ namespace ts.server {
10201026 return ;
10211027 }
10221028 }
1023- this . projectService . logger . info ( `Couldn't find ${ pluginConfigEntry . name } anywhere in paths: ${ searchPaths . join ( "," ) } ` ) ;
1029+ this . projectService . logger . info ( `Couldn't find ${ pluginConfigEntry . name } ` ) ;
10241030 }
10251031
10261032 private enableProxy ( pluginModuleFactory : PluginModuleFactory , configEntry : PluginImport ) {
@@ -1039,7 +1045,15 @@ namespace ts.server {
10391045 } ;
10401046
10411047 const pluginModule = pluginModuleFactory ( { typescript : ts } ) ;
1042- this . languageService = pluginModule . create ( info ) ;
1048+ const newLS = pluginModule . create ( info ) ;
1049+ for ( const k of Object . keys ( this . languageService ) ) {
1050+ if ( ! ( k in newLS ) ) {
1051+ this . projectService . logger . info ( `Plugin activation warning: Missing proxied method ${ k } in created LS. Patching.` ) ;
1052+ ( newLS as any ) [ k ] = ( this . languageService as any ) [ k ] ;
1053+ }
1054+ }
1055+ this . projectService . logger . info ( `Plugin validation succeded` ) ;
1056+ this . languageService = newLS ;
10431057 this . plugins . push ( pluginModule ) ;
10441058 }
10451059 catch ( e ) {
0 commit comments