Skip to content

Commit 675b6fb

Browse files
author
Armando Aguirre
committed
Fixed failing tests and lint. Added unit tests.
1 parent 5b86055 commit 675b6fb

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
@@ -1511,15 +1511,16 @@ namespace ts {
15111511
function getReferences(fileName: string, position: number, options?: FindAllReferences.Options) {
15121512
synchronizeHostData();
15131513

1514-
//Exclude default library when renaming as commonly user don't want to change that file.
1514+
// Exclude default library when renaming as commonly user don't want to change that file.
15151515
let sourceFiles: SourceFile[] = [];
1516-
if (options.isForRename) {
1517-
for (let sourceFile of program.getSourceFiles()) {
1516+
if (options && options.isForRename) {
1517+
for (const sourceFile of program.getSourceFiles()) {
15181518
if (!program.isSourceFileDefaultLibrary(sourceFile)) {
15191519
sourceFiles.push(sourceFile);
15201520
}
15211521
}
1522-
} else {
1522+
}
1523+
else {
15231524
sourceFiles = program.getSourceFiles();
15241525
}
15251526

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)