Skip to content

Commit 37d806c

Browse files
author
Armando Aguirre
committed
Fixed failing tests and lint. Added unit tests.
1 parent 4329e60 commit 37d806c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/services/services.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,15 +1507,16 @@ namespace ts {
15071507
function getReferences(fileName: string, position: number, options?: FindAllReferences.Options) {
15081508
synchronizeHostData();
15091509

1510-
//Exclude default library when renaming as commonly user don't want to change that file.
1510+
// Exclude default library when renaming as commonly user don't want to change that file.
15111511
let sourceFiles: SourceFile[] = [];
1512-
if (options.isForRename) {
1513-
for (let sourceFile of program.getSourceFiles()) {
1512+
if (options && options.isForRename) {
1513+
for (const sourceFile of program.getSourceFiles()) {
15141514
if (!program.isSourceFileDefaultLibrary(sourceFile)) {
15151515
sourceFiles.push(sourceFile);
15161516
}
15171517
}
1518-
} else {
1518+
}
1519+
else {
15191520
sourceFiles = program.getSourceFiles();
15201521
}
15211522

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// Tests that tokens found on the default library are not renamed.
4+
// "test" is a comment on the default library.
5+
6+
// @Filename: file1.ts
7+
//// var [|test|] = "foo";
8+
//// console.log([|test|]);
9+
10+
const ranges = test.ranges();
11+
verify.renameLocations(ranges[0], { findInComments: true, ranges });

0 commit comments

Comments
 (0)