@@ -31,26 +31,32 @@ export default class TsConfigProvider extends vscode.Disposable {
3131 return this . tsconfigs . values ( ) ;
3232 }
3333
34- private async ensureActivated ( ) {
34+ private async ensureActivated ( ) : Promise < this > {
3535 if ( this . activated ) {
3636 return this ;
3737 }
3838 this . activated = true ;
3939
40- for ( const config of await TsConfigProvider . loadWorkspaceTsconfigs ( ) ) {
41- this . handleProjectCreate ( config ) ;
42- }
40+ this . reloadWorkspaceConfigs ( ) ;
4341
4442 const configFileWatcher = vscode . workspace . createFileSystemWatcher ( '**/tsconfig*.json' ) ;
4543 this . disposables . push ( configFileWatcher ) ;
4644 configFileWatcher . onDidCreate ( this . handleProjectCreate , this , this . disposables ) ;
4745 configFileWatcher . onDidDelete ( this . handleProjectDelete , this , this . disposables ) ;
4846
47+ vscode . workspace . onDidChangeWorkspaceFolders ( ( ) => {
48+ this . reloadWorkspaceConfigs ( ) ;
49+ } , this , this . disposables ) ;
50+
4951 return this ;
5052 }
5153
52- private static loadWorkspaceTsconfigs ( ) {
53- return vscode . workspace . findFiles ( '**/tsconfig*.json' , '**/node_modules/**' ) ;
54+ private async reloadWorkspaceConfigs ( ) : Promise < this> {
55+ this . tsconfigs . clear ( ) ;
56+ for ( const config of await vscode . workspace . findFiles ( '**/tsconfig*.json' , '**/node_modules/**' ) ) {
57+ this . handleProjectCreate ( config ) ;
58+ }
59+ return this ;
5460 }
5561
5662 private handleProjectCreate ( config : vscode . Uri ) {
0 commit comments