@@ -315,6 +315,7 @@ namespace ts.server {
315
315
projects ,
316
316
defaultProject ,
317
317
initialLocation ,
318
+ /*isForRename*/ true ,
318
319
( project , position ) => project . getLanguageService ( ) . findRenameLocations ( position . fileName , position . pos , findInStrings , findInComments , providePrefixAndSuffixTextForRename ) ,
319
320
( renameLocation , cb ) => cb ( documentSpanLocation ( renameLocation ) ) ,
320
321
) ;
@@ -340,8 +341,8 @@ namespace ts.server {
340
341
return results ;
341
342
}
342
343
343
- function getDefinitionLocation ( defaultProject : Project , initialLocation : DocumentPosition ) : DocumentPosition | undefined {
344
- const infos = defaultProject . getLanguageService ( ) . getDefinitionAtPosition ( initialLocation . fileName , initialLocation . pos ) ;
344
+ function getDefinitionLocation ( defaultProject : Project , initialLocation : DocumentPosition , isForRename : boolean ) : DocumentPosition | undefined {
345
+ const infos = defaultProject . getLanguageService ( ) . getDefinitionAtPosition ( initialLocation . fileName , initialLocation . pos , /*searchOtherFilesOnly*/ false , /*stopAtAlias*/ isForRename ) ;
345
346
const info = infos && firstOrUndefined ( infos ) ;
346
347
return info && ! info . isLocal ? { fileName : info . fileName , pos : info . textSpan . start } : undefined ;
347
348
}
@@ -356,6 +357,7 @@ namespace ts.server {
356
357
projects ,
357
358
defaultProject ,
358
359
initialLocation ,
360
+ /*isForRename*/ false ,
359
361
( project , position ) => {
360
362
logger . info ( `Finding references to ${ position . fileName } position ${ position . pos } in project ${ project . getProjectName ( ) } ` ) ;
361
363
return project . getLanguageService ( ) . findReferences ( position . fileName , position . pos ) ;
@@ -495,6 +497,7 @@ namespace ts.server {
495
497
projects : Projects ,
496
498
defaultProject : Project ,
497
499
initialLocation : DocumentPosition ,
500
+ isForRename : boolean ,
498
501
getResultsForPosition : ( project : Project , location : DocumentPosition ) => readonly TResult [ ] | undefined ,
499
502
forPositionInResult : ( result : TResult , cb : ( location : DocumentPosition ) => void ) => void ,
500
503
) : readonly TResult [ ] | ESMap < Project , readonly TResult [ ] > {
@@ -518,7 +521,7 @@ namespace ts.server {
518
521
const projectService = defaultProject . projectService ;
519
522
const cancellationToken = defaultProject . getCancellationToken ( ) ;
520
523
521
- const defaultDefinition = getDefinitionLocation ( defaultProject , initialLocation ) ;
524
+ const defaultDefinition = getDefinitionLocation ( defaultProject , initialLocation , isForRename ) ;
522
525
523
526
// Don't call these unless !!defaultDefinition
524
527
const getGeneratedDefinition = memoize ( ( ) => defaultProject . isSourceOfProjectReferenceRedirect ( defaultDefinition ! . fileName ) ?
0 commit comments