@@ -164,10 +164,22 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
164
164
return ;
165
165
}
166
166
167
+ const linkRange = results [ 0 ] . originSelectionRange
168
+ ? Range . lift ( results [ 0 ] . originSelectionRange )
169
+ : new Range ( position . lineNumber , word . startColumn , position . lineNumber , word . endColumn ) ;
170
+
167
171
// Multiple results
168
172
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
+
169
181
this . addDecoration (
170
- new Range ( position . lineNumber , word . startColumn , position . lineNumber , word . endColumn ) ,
182
+ combinedRange ,
171
183
new MarkdownString ( ) . appendText ( nls . localize ( 'multipleResults' , "Click to show {0} definitions." , results . length ) )
172
184
) ;
173
185
}
@@ -197,17 +209,9 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
197
209
}
198
210
199
211
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
-
208
212
const languageId = this . languageService . guessLanguageIdByFilepathOrFirstLine ( textEditorModel . uri ) ;
209
213
this . addDecoration (
210
- wordRange ,
214
+ linkRange ,
211
215
new MarkdownString ( ) . appendCodeblock ( languageId ? languageId : '' , previewValue )
212
216
) ;
213
217
ref . dispose ( ) ;
0 commit comments