Fixed failing tests and lint. Added unit tests.
This commit is contained in:
parent
5b86055786
commit
675b6fb90c
2 changed files with 16 additions and 4 deletions
|
@ -1511,15 +1511,16 @@ namespace ts {
|
|||
function getReferences(fileName: string, position: number, options?: FindAllReferences.Options) {
|
||||
synchronizeHostData();
|
||||
|
||||
//Exclude default library when renaming as commonly user don't want to change that file.
|
||||
// Exclude default library when renaming as commonly user don't want to change that file.
|
||||
let sourceFiles: SourceFile[] = [];
|
||||
if (options.isForRename) {
|
||||
for (let sourceFile of program.getSourceFiles()) {
|
||||
if (options && options.isForRename) {
|
||||
for (const sourceFile of program.getSourceFiles()) {
|
||||
if (!program.isSourceFileDefaultLibrary(sourceFile)) {
|
||||
sourceFiles.push(sourceFile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sourceFiles = program.getSourceFiles();
|
||||
}
|
||||
|
||||
|
|
11
tests/cases/fourslash/renameDefaultLibDontWork.ts
Normal file
11
tests/cases/fourslash/renameDefaultLibDontWork.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Tests that tokens found on the default library are not renamed.
|
||||
// "test" is a comment on the default library.
|
||||
|
||||
// @Filename: file1.ts
|
||||
//// var [|test|] = "foo";
|
||||
//// console.log([|test|]);
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.renameLocations(ranges[0], { findInComments: true, ranges });
|
Loading…
Reference in a new issue