@@ -164,10 +164,22 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
164164 return ;
165165 }
166166
167+ const linkRange = results [ 0 ] . originSelectionRange
168+ ? Range . lift ( results [ 0 ] . originSelectionRange )
169+ : new Range ( position . lineNumber , word . startColumn , position . lineNumber , word . endColumn ) ;
170+
167171 // Multiple results
168172 if ( results . length > 1 ) {
173+
174+ let combinedRange = linkRange ;
175+ for ( const { originSelectionRange } of results ) {
176+ if ( originSelectionRange ) {
177+ combinedRange = Range . plusRange ( combinedRange , originSelectionRange ) ;
178+ }
179+ }
180+
169181 this . addDecoration (
170- new Range ( position . lineNumber , word . startColumn , position . lineNumber , word . endColumn ) ,
182+ combinedRange ,
171183 new MarkdownString ( ) . appendText ( nls . localize ( 'multipleResults' , "Click to show {0} definitions." , results . length ) )
172184 ) ;
173185 }
@@ -197,17 +209,9 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
197209 }
198210
199211 const previewValue = this . getPreviewValue ( textEditorModel , startLineNumber , result ) ;
200-
201- let wordRange : Range ;
202- if ( result . originSelectionRange ) {
203- wordRange = Range . lift ( result . originSelectionRange ) ;
204- } else {
205- wordRange = new Range ( position . lineNumber , word . startColumn , position . lineNumber , word . endColumn ) ;
206- }
207-
208212 const languageId = this . languageService . guessLanguageIdByFilepathOrFirstLine ( textEditorModel . uri ) ;
209213 this . addDecoration (
210- wordRange ,
214+ linkRange ,
211215 new MarkdownString ( ) . appendCodeblock ( languageId ? languageId : '' , previewValue )
212216 ) ;
213217 ref . dispose ( ) ;
0 commit comments