@@ -742,7 +742,8 @@ namespace ts.server {
742
742
}
743
743
// compute and return the difference
744
744
const lastReportedFileNames = this . lastReportedFileNames ;
745
- const currentFiles = arrayToSet ( this . getFileNames ( ) ) ;
745
+ const externalFiles = this . getExternalFiles ( ) . map ( f => toNormalizedPath ( f ) ) ;
746
+ const currentFiles = arrayToSet ( this . getFileNames ( ) . concat ( externalFiles ) ) ;
746
747
747
748
const added : string [ ] = [ ] ;
748
749
const removed : string [ ] = [ ] ;
@@ -765,7 +766,8 @@ namespace ts.server {
765
766
else {
766
767
// unknown version - return everything
767
768
const projectFileNames = this . getFileNames ( ) ;
768
- this . lastReportedFileNames = arrayToSet ( projectFileNames ) ;
769
+ const externalFiles = this . getExternalFiles ( ) . map ( f => toNormalizedPath ( f ) ) ;
770
+ this . lastReportedFileNames = arrayToSet ( projectFileNames . concat ( externalFiles ) ) ;
769
771
this . lastReportedVersion = this . projectStructureVersion ;
770
772
return { info, files : projectFileNames , projectErrors : this . getGlobalProjectErrors ( ) } ;
771
773
}
@@ -994,16 +996,22 @@ namespace ts.server {
994
996
if ( this . projectService . globalPlugins ) {
995
997
// Enable global plugins with synthetic configuration entries
996
998
for ( const globalPluginName of this . projectService . globalPlugins ) {
999
+ // Skip empty names from odd commandline parses
1000
+ if ( ! globalPluginName ) continue ;
1001
+
997
1002
// Skip already-locally-loaded plugins
998
1003
if ( options . plugins && options . plugins . some ( p => p . name === globalPluginName ) ) continue ;
999
1004
1000
1005
// Provide global: true so plugins can detect why they can't find their config
1006
+ this . projectService . logger . info ( `Loading global plugin ${ globalPluginName } ` ) ;
1001
1007
this . enablePlugin ( { name : globalPluginName , global : true } as PluginImport , searchPaths ) ;
1002
1008
}
1003
1009
}
1004
1010
}
1005
1011
1006
1012
private enablePlugin ( pluginConfigEntry : PluginImport , searchPaths : string [ ] ) {
1013
+ this . projectService . logger . info ( `Enabling plugin ${ pluginConfigEntry . name } from candidate paths: ${ searchPaths . join ( "," ) } ` ) ;
1014
+
1007
1015
const log = ( message : string ) => {
1008
1016
this . projectService . logger . info ( message ) ;
1009
1017
} ;
@@ -1015,7 +1023,7 @@ namespace ts.server {
1015
1023
return ;
1016
1024
}
1017
1025
}
1018
- this . projectService . logger . info ( `Couldn't find ${ pluginConfigEntry . name } anywhere in paths: ${ searchPaths . join ( "," ) } ` ) ;
1026
+ this . projectService . logger . info ( `Couldn't find ${ pluginConfigEntry . name } ` ) ;
1019
1027
}
1020
1028
1021
1029
private enableProxy ( pluginModuleFactory : PluginModuleFactory , configEntry : PluginImport ) {
@@ -1034,7 +1042,15 @@ namespace ts.server {
1034
1042
} ;
1035
1043
1036
1044
const pluginModule = pluginModuleFactory ( { typescript : ts } ) ;
1037
- this . languageService = pluginModule . create ( info ) ;
1045
+ const newLS = pluginModule . create ( info ) ;
1046
+ for ( const k of Object . keys ( this . languageService ) ) {
1047
+ if ( ! ( k in newLS ) ) {
1048
+ this . projectService . logger . info ( `Plugin activation warning: Missing proxied method ${ k } in created LS. Patching.` ) ;
1049
+ ( newLS as any ) [ k ] = ( this . languageService as any ) [ k ] ;
1050
+ }
1051
+ }
1052
+ this . projectService . logger . info ( `Plugin validation succeded` ) ;
1053
+ this . languageService = newLS ;
1038
1054
this . plugins . push ( pluginModule ) ;
1039
1055
}
1040
1056
catch ( e ) {
@@ -1066,6 +1082,9 @@ namespace ts.server {
1066
1082
}
1067
1083
catch ( e ) {
1068
1084
this . projectService . logger . info ( `A plugin threw an exception in getExternalFiles: ${ e } ` ) ;
1085
+ if ( e . stack ) {
1086
+ this . projectService . logger . info ( e . stack ) ;
1087
+ }
1069
1088
}
1070
1089
} ) ) ;
1071
1090
}
@@ -1174,6 +1193,7 @@ namespace ts.server {
1174
1193
public compileOnSaveEnabled : boolean ,
1175
1194
private readonly projectFilePath ?: string ) {
1176
1195
super ( externalProjectName , ProjectKind . External , projectService , documentRegistry , /*hasExplicitListOfFiles*/ true , languageServiceEnabled , compilerOptions , compileOnSaveEnabled ) ;
1196
+
1177
1197
}
1178
1198
1179
1199
getProjectRootPath ( ) {
0 commit comments