@@ -642,7 +642,14 @@ export class TestControllerManager {
642
642
643
643
try {
644
644
const o : { [ key : string ] : string } = { } ;
645
- o [ document . fileName ] = document . getText ( ) ;
645
+ for ( const document of vscode . workspace . textDocuments ) {
646
+ if (
647
+ SUPPORTED_LANGUAGES . includes ( document . languageId ) &&
648
+ vscode . workspace . getWorkspaceFolder ( document . uri ) === folder
649
+ ) {
650
+ o [ document . fileName ] = document . getText ( ) ;
651
+ }
652
+ }
646
653
647
654
if ( this . diagnosticCollection . has ( document . uri ) ) {
648
655
this . diagnosticCollection . delete ( document . uri ) ;
@@ -813,6 +820,10 @@ export class TestControllerManager {
813
820
}
814
821
} ) ;
815
822
itemsToRemove . forEach ( ( i ) => {
823
+ const item = this . testItems . get ( i ) ;
824
+ if ( item !== undefined && item . canResolveChildren ) {
825
+ this . removeNotAddedTestItems ( item , new Set < string > ( ) ) ;
826
+ }
816
827
items . delete ( i ) ;
817
828
this . testItems . delete ( i ) ;
818
829
} ) ;
@@ -864,8 +875,17 @@ export class TestControllerManager {
864
875
}
865
876
866
877
private refreshUri ( uri ?: vscode . Uri , reason ?: string ) {
878
+ this . outputChannel . appendLine ( `refresh uri ${ uri ? uri . toString ( ) : "unknown" } because: ${ reason ?? "unknown" } ` ) ;
879
+
867
880
if ( uri ) {
868
- this . outputChannel . appendLine ( `refresh uri ${ uri . toString ( ) } ` ) ;
881
+ const testItem = this . findTestItemByUri ( uri . toString ( ) ) ;
882
+ if ( testItem ) {
883
+ this . refreshItem ( testItem ) . then (
884
+ ( _ ) => undefined ,
885
+ ( _ ) => undefined
886
+ ) ;
887
+ return ;
888
+ }
869
889
870
890
const workspace = vscode . workspace . getWorkspaceFolder ( uri ) ;
871
891
if ( workspace === undefined ) return ;
0 commit comments