@@ -1996,23 +1996,20 @@ namespace ts.server {
19961996 return this . openClientFileWithNormalizedPath ( toNormalizedPath ( fileName ) , fileContent , scriptKind , /*hasMixedContent*/ false , projectRootPath ? toNormalizedPath ( projectRootPath ) : undefined ) ;
19971997 }
19981998
1999- private findExternalProjetContainingOpenScriptInfo ( info : ScriptInfo ) : ExternalProject {
2000- for ( const proj of this . externalProjects ) {
2001- // Ensure project structure is uptodate to check if info is present in external project
1999+ private findExternalProjectContainingOpenScriptInfo ( info : ScriptInfo ) : ExternalProject | undefined {
2000+ return find ( this . externalProjects , proj => {
2001+ // Ensure project structure is up-to-date to check if info is present in external project
20022002 proj . updateGraph ( ) ;
2003- if ( proj . containsScriptInfo ( info ) ) {
2004- return proj ;
2005- }
2006- }
2007- return undefined ;
2003+ return proj . containsScriptInfo ( info ) ;
2004+ } ) ;
20082005 }
20092006
20102007 openClientFileWithNormalizedPath ( fileName : NormalizedPath , fileContent ?: string , scriptKind ?: ScriptKind , hasMixedContent ?: boolean , projectRootPath ?: NormalizedPath ) : OpenConfiguredProjectResult {
20112008 let configFileName : NormalizedPath ;
20122009 let configFileErrors : ReadonlyArray < Diagnostic > ;
20132010
20142011 const info = this . getOrCreateScriptInfoOpenedByClientForNormalizedPath ( fileName , projectRootPath ? this . getNormalizedAbsolutePath ( projectRootPath ) : this . currentDirectory , fileContent , scriptKind , hasMixedContent ) ;
2015- let project : ConfiguredProject | ExternalProject = this . findExternalProjetContainingOpenScriptInfo ( info ) ;
2012+ let project : ConfiguredProject | ExternalProject | undefined = this . findExternalProjectContainingOpenScriptInfo ( info ) ;
20162013 if ( ! project && ! this . syntaxOnly ) { // Checking syntaxOnly is an optimization
20172014 configFileName = this . getConfigFileNameForFile ( info , projectRootPath ) ;
20182015 if ( configFileName ) {
0 commit comments