@@ -670,7 +670,7 @@ namespace ts {
670
670
if ( ! hasModifier ( node , ModifierFlags . ParameterPropertyModifier ) ) {
671
671
break ;
672
672
}
673
- // falls through
673
+ // falls through
674
674
case SyntaxKind . VariableDeclaration :
675
675
case SyntaxKind . BindingElement : {
676
676
const decl = < VariableDeclaration > node ;
@@ -682,7 +682,7 @@ namespace ts {
682
682
visit ( decl . initializer ) ;
683
683
}
684
684
}
685
- // falls through
685
+ // falls through
686
686
case SyntaxKind . EnumMember :
687
687
case SyntaxKind . PropertyDeclaration :
688
688
case SyntaxKind . PropertySignature :
@@ -729,7 +729,7 @@ namespace ts {
729
729
730
730
class SourceMapSourceObject implements SourceMapSource {
731
731
lineMap : number [ ] ;
732
- constructor ( public fileName : string , public text : string , public skipTrivia ?: ( pos : number ) => number ) { }
732
+ constructor ( public fileName : string , public text : string , public skipTrivia ?: ( pos : number ) => number ) { }
733
733
734
734
public getLineAndCharacterOfPosition ( pos : number ) : LineAndCharacter {
735
735
return ts . getLineAndCharacterOfPosition ( this , pos ) ;
@@ -1130,14 +1130,14 @@ namespace ts {
1130
1130
const newSettings = hostCache . compilationSettings ( ) ;
1131
1131
const shouldCreateNewSourceFiles = oldSettings &&
1132
1132
( oldSettings . target !== newSettings . target ||
1133
- oldSettings . module !== newSettings . module ||
1134
- oldSettings . moduleResolution !== newSettings . moduleResolution ||
1135
- oldSettings . noResolve !== newSettings . noResolve ||
1136
- oldSettings . jsx !== newSettings . jsx ||
1137
- oldSettings . allowJs !== newSettings . allowJs ||
1138
- oldSettings . disableSizeLimit !== oldSettings . disableSizeLimit ||
1139
- oldSettings . baseUrl !== newSettings . baseUrl ||
1140
- ! equalOwnProperties ( oldSettings . paths , newSettings . paths ) ) ;
1133
+ oldSettings . module !== newSettings . module ||
1134
+ oldSettings . moduleResolution !== newSettings . moduleResolution ||
1135
+ oldSettings . noResolve !== newSettings . noResolve ||
1136
+ oldSettings . jsx !== newSettings . jsx ||
1137
+ oldSettings . allowJs !== newSettings . allowJs ||
1138
+ oldSettings . disableSizeLimit !== oldSettings . disableSizeLimit ||
1139
+ oldSettings . baseUrl !== newSettings . baseUrl ||
1140
+ ! equalOwnProperties ( oldSettings . paths , newSettings . paths ) ) ;
1141
1141
1142
1142
// Now create a new compiler
1143
1143
const compilerHost : CompilerHost = {
@@ -1365,7 +1365,7 @@ namespace ts {
1365
1365
function getCompilerOptionsDiagnostics ( ) {
1366
1366
synchronizeHostData ( ) ;
1367
1367
return program . getOptionsDiagnostics ( cancellationToken ) . concat (
1368
- program . getGlobalDiagnostics ( cancellationToken ) ) ;
1368
+ program . getGlobalDiagnostics ( cancellationToken ) ) ;
1369
1369
}
1370
1370
1371
1371
function getCompletionsAtPosition ( fileName : string , position : number ) : CompletionInfo {
@@ -1510,7 +1510,20 @@ namespace ts {
1510
1510
1511
1511
function getReferences ( fileName : string , position : number , options ?: FindAllReferences . Options ) {
1512
1512
synchronizeHostData ( ) ;
1513
- return FindAllReferences . findReferencedEntries ( program , cancellationToken , program . getSourceFiles ( ) , getValidSourceFile ( fileName ) , position , options ) ;
1513
+
1514
+ //Exclude default library when renaming as commonly user don't want to change that file.
1515
+ let sourceFiles : SourceFile [ ] = [ ] ;
1516
+ if ( options . isForRename ) {
1517
+ for ( let sourceFile of program . getSourceFiles ( ) ) {
1518
+ if ( ! program . isSourceFileDefaultLibrary ( sourceFile ) ) {
1519
+ sourceFiles . push ( sourceFile ) ;
1520
+ }
1521
+ }
1522
+ } else {
1523
+ sourceFiles = program . getSourceFiles ( ) ;
1524
+ }
1525
+
1526
+ return FindAllReferences . findReferencedEntries ( program , cancellationToken , sourceFiles , getValidSourceFile ( fileName ) , position , options ) ;
1514
1527
}
1515
1528
1516
1529
function findReferences ( fileName : string , position : number ) : ReferencedSymbol [ ] {
@@ -2100,7 +2113,7 @@ namespace ts {
2100
2113
isLiteralComputedPropertyDeclarationName ( node ) ;
2101
2114
}
2102
2115
2103
- function isObjectLiteralElement ( node : Node ) : node is ObjectLiteralElement {
2116
+ function isObjectLiteralElement ( node : Node ) : node is ObjectLiteralElement {
2104
2117
switch ( node . kind ) {
2105
2118
case SyntaxKind . JsxAttribute :
2106
2119
case SyntaxKind . JsxSpreadAttribute :
@@ -2125,7 +2138,7 @@ namespace ts {
2125
2138
if ( node . parent . kind === SyntaxKind . ComputedPropertyName ) {
2126
2139
return isObjectLiteralElement ( node . parent . parent ) ? node . parent . parent : undefined ;
2127
2140
}
2128
- // falls through
2141
+ // falls through
2129
2142
case SyntaxKind . Identifier :
2130
2143
return isObjectLiteralElement ( node . parent ) &&
2131
2144
( node . parent . parent . kind === SyntaxKind . ObjectLiteralExpression || node . parent . parent . kind === SyntaxKind . JsxAttributes ) &&
0 commit comments