Skip to content

Commit 4f80fbd

Browse files
author
Andy
authored
Fix typo and use array helper (microsoft#23169)
* Fix typo and use array helper * Update API baselines
1 parent 9dd8e29 commit 4f80fbd

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

src/server/editorServices.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8077,7 +8077,7 @@ declare namespace ts.server {
80778077
* @param fileContent is a known version of the file content that is more up to date than the one on disk
80788078
*/
80798079
openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult;
8080-
private findExternalProjetContainingOpenScriptInfo;
8080+
private findExternalProjectContainingOpenScriptInfo;
80818081
openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
80828082
/**
80838083
* Close file whose contents is managed by the client

0 commit comments

Comments
 (0)