@@ -57,7 +57,6 @@ export class Session {
57
57
private readonly logger : ts . server . Logger ;
58
58
private readonly ivy : boolean ;
59
59
private readonly disableAutomaticNgcc : boolean ;
60
- private readonly configuredProjToExternalProj = new Map < string , string > ( ) ;
61
60
private readonly logToConsole : boolean ;
62
61
private readonly openFiles = new MruTracker ( ) ;
63
62
private readonly includeAutomaticOptionalChainCompletions : boolean ;
@@ -624,7 +623,6 @@ export class Session {
624
623
scriptInfo . detachAllProjects ( ) ;
625
624
scriptInfo . attachToProject ( project ) ;
626
625
}
627
- this . createExternalProject ( project ) ;
628
626
629
627
return project ;
630
628
}
@@ -719,24 +717,6 @@ export class Session {
719
717
}
720
718
throw error ;
721
719
}
722
- this . closeOrphanedExternalProjects ( ) ;
723
- }
724
-
725
- /**
726
- * Creates an external project with the same config path as `project` so that TypeScript keeps the
727
- * project open when navigating away from `html` files.
728
- */
729
- private createExternalProject ( project : ts . server . Project ) : void {
730
- if ( isConfiguredProject ( project ) &&
731
- ! this . configuredProjToExternalProj . has ( project . projectName ) ) {
732
- const extProjectName = `${ project . projectName } -external` ;
733
- project . projectService . openExternalProject ( {
734
- projectFileName : extProjectName ,
735
- rootFiles : [ { fileName : project . getConfigFilePath ( ) } ] ,
736
- options : { }
737
- } ) ;
738
- this . configuredProjToExternalProj . set ( project . projectName , extProjectName ) ;
739
- }
740
720
}
741
721
742
722
private onDidCloseTextDocument ( params : lsp . DidCloseTextDocumentParams ) {
@@ -749,33 +729,6 @@ export class Session {
749
729
this . projectService . closeClientFile ( filePath ) ;
750
730
}
751
731
752
- /**
753
- * We open external projects for files so that we can prevent TypeScript from closing a project
754
- * when there is open external HTML template that still references the project. This function
755
- * checks if there are no longer any open files in any external project. If there
756
- * aren't, we also close the external project that was created.
757
- */
758
- private closeOrphanedExternalProjects ( ) : void {
759
- for ( const [ configuredProjName , externalProjName ] of this . configuredProjToExternalProj ) {
760
- const configuredProj = this . projectService . findProject ( configuredProjName ) ;
761
- if ( ! configuredProj || configuredProj . isClosed ( ) ) {
762
- this . projectService . closeExternalProject ( externalProjName ) ;
763
- this . configuredProjToExternalProj . delete ( configuredProjName ) ;
764
- continue ;
765
- }
766
- // See if any openFiles belong to the configured project.
767
- // if not, close external project this.projectService.openFiles
768
- const openFiles = toArray ( this . projectService . openFiles . keys ( ) ) ;
769
- if ( ! openFiles . some ( file => {
770
- const scriptInfo = this . projectService . getScriptInfo ( file ) ;
771
- return scriptInfo ?. isAttached ( configuredProj ) ;
772
- } ) ) {
773
- this . projectService . closeExternalProject ( externalProjName ) ;
774
- this . configuredProjToExternalProj . delete ( configuredProjName ) ;
775
- }
776
- }
777
- }
778
-
779
732
private onDidChangeTextDocument ( params : lsp . DidChangeTextDocumentParams ) : void {
780
733
const { contentChanges, textDocument} = params ;
781
734
const filePath = uriToFilePath ( textDocument . uri ) ;
0 commit comments