@@ -2987,7 +2987,6 @@ namespace ts {
2987
2987
2988
2988
function getCompletionData ( fileName : string , position : number ) {
2989
2989
const typeChecker = program . getTypeChecker ( ) ;
2990
- const syntacticStart = new Date ( ) . getTime ( ) ;
2991
2990
const sourceFile = getValidSourceFile ( fileName ) ;
2992
2991
const isJavaScriptFile = isSourceFileJavaScript ( sourceFile ) ;
2993
2992
@@ -6166,10 +6165,6 @@ namespace ts {
6166
6165
return ts . NavigateTo . getNavigateToItems ( program , cancellationToken , searchValue , maxResultCount ) ;
6167
6166
}
6168
6167
6169
- function containErrors ( diagnostics : Diagnostic [ ] ) : boolean {
6170
- return forEach ( diagnostics , diagnostic => diagnostic . category === DiagnosticCategory . Error ) ;
6171
- }
6172
-
6173
6168
function getEmitOutput ( fileName : string ) : EmitOutput {
6174
6169
synchronizeHostData ( ) ;
6175
6170
@@ -7045,7 +7040,6 @@ namespace ts {
7045
7040
* be performed.
7046
7041
*/
7047
7042
function getDocCommentTemplateAtPosition ( fileName : string , position : number ) : TextInsertion {
7048
- const start = new Date ( ) . getTime ( ) ;
7049
7043
const sourceFile = syntaxTreeCache . getCurrentSourceFile ( fileName ) ;
7050
7044
7051
7045
// Check if in a context where we don't want to perform any insertion
@@ -7339,11 +7333,17 @@ namespace ts {
7339
7333
if ( declarations && declarations . length > 0 ) {
7340
7334
// Disallow rename for elements that are defined in the standard TypeScript library.
7341
7335
const defaultLibFileName = host . getDefaultLibFileName ( host . getCompilationSettings ( ) ) ;
7336
+ const canonicalDefaultLibName = getCanonicalFileName ( ts . normalizePath ( defaultLibFileName ) ) ;
7342
7337
if ( defaultLibFileName ) {
7343
7338
for ( const current of declarations ) {
7344
7339
const sourceFile = current . getSourceFile ( ) ;
7340
+ // TODO (drosen): When is there no source file?
7341
+ if ( ! sourceFile ) {
7342
+ continue ;
7343
+ }
7344
+
7345
7345
const canonicalName = getCanonicalFileName ( ts . normalizePath ( sourceFile . fileName ) ) ;
7346
- if ( sourceFile && getCanonicalFileName ( ts . normalizePath ( sourceFile . fileName ) ) === getCanonicalFileName ( ts . normalizePath ( defaultLibFileName ) ) ) {
7346
+ if ( canonicalName === canonicalDefaultLibName ) {
7347
7347
return getRenameInfoError ( getLocaleSpecificMessage ( Diagnostics . You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library ) ) ;
7348
7348
}
7349
7349
}
0 commit comments