@@ -315,6 +315,7 @@ namespace ts.server {
315315 projects ,
316316 defaultProject ,
317317 initialLocation ,
318+ /*isForRename*/ true ,
318319 ( project , position ) => project . getLanguageService ( ) . findRenameLocations ( position . fileName , position . pos , findInStrings , findInComments , providePrefixAndSuffixTextForRename ) ,
319320 ( renameLocation , cb ) => cb ( documentSpanLocation ( renameLocation ) ) ,
320321 ) ;
@@ -340,8 +341,8 @@ namespace ts.server {
340341 return results ;
341342 }
342343
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 ) ;
345346 const info = infos && firstOrUndefined ( infos ) ;
346347 return info && ! info . isLocal ? { fileName : info . fileName , pos : info . textSpan . start } : undefined ;
347348 }
@@ -356,6 +357,7 @@ namespace ts.server {
356357 projects ,
357358 defaultProject ,
358359 initialLocation ,
360+ /*isForRename*/ false ,
359361 ( project , position ) => {
360362 logger . info ( `Finding references to ${ position . fileName } position ${ position . pos } in project ${ project . getProjectName ( ) } ` ) ;
361363 return project . getLanguageService ( ) . findReferences ( position . fileName , position . pos ) ;
@@ -495,6 +497,7 @@ namespace ts.server {
495497 projects : Projects ,
496498 defaultProject : Project ,
497499 initialLocation : DocumentPosition ,
500+ isForRename : boolean ,
498501 getResultsForPosition : ( project : Project , location : DocumentPosition ) => readonly TResult [ ] | undefined ,
499502 forPositionInResult : ( result : TResult , cb : ( location : DocumentPosition ) => void ) => void ,
500503 ) : readonly TResult [ ] | ESMap < Project , readonly TResult [ ] > {
@@ -518,7 +521,7 @@ namespace ts.server {
518521 const projectService = defaultProject . projectService ;
519522 const cancellationToken = defaultProject . getCancellationToken ( ) ;
520523
521- const defaultDefinition = getDefinitionLocation ( defaultProject , initialLocation ) ;
524+ const defaultDefinition = getDefinitionLocation ( defaultProject , initialLocation , isForRename ) ;
522525
523526 // Don't call these unless !!defaultDefinition
524527 const getGeneratedDefinition = memoize ( ( ) => defaultProject . isSourceOfProjectReferenceRedirect ( defaultDefinition ! . fileName ) ?
0 commit comments