Skip to content

Commit f411164

Browse files
author
Andy
authored
Simplify calculation of sourceFiles for getReferences (microsoft#24475)
1 parent e99be8c commit f411164

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/services/services.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,17 +1735,9 @@ namespace ts {
17351735
synchronizeHostData();
17361736

17371737
// Exclude default library when renaming as commonly user don't want to change that file.
1738-
let sourceFiles: SourceFile[] = [];
1739-
if (options && options.isForRename) {
1740-
for (const sourceFile of program.getSourceFiles()) {
1741-
if (!program.isSourceFileDefaultLibrary(sourceFile)) {
1742-
sourceFiles.push(sourceFile);
1743-
}
1744-
}
1745-
}
1746-
else {
1747-
sourceFiles = program.getSourceFiles().slice();
1748-
}
1738+
const sourceFiles = options && options.isForRename
1739+
? program.getSourceFiles().filter(sourceFile => !program.isSourceFileDefaultLibrary(sourceFile))
1740+
: program.getSourceFiles();
17491741

17501742
return FindAllReferences.findReferencedEntries(program, cancellationToken, sourceFiles, getValidSourceFile(fileName), position, options);
17511743
}

0 commit comments

Comments
 (0)