@@ -94,7 +94,7 @@ export abstract class SymbolNavigationAction extends EditorAction {
94
94
this . configuration = configuration ;
95
95
}
96
96
97
- run ( accessor : ServicesAccessor , editor : ICodeEditor , arg ?: SymbolNavigationAnchor | unknown ) : Promise < void > {
97
+ run ( accessor : ServicesAccessor , editor : ICodeEditor , arg ?: SymbolNavigationAnchor | unknown , range ?: Range ) : Promise < void > {
98
98
if ( ! editor . hasModel ( ) ) {
99
99
return Promise . resolve ( undefined ) ;
100
100
}
@@ -143,7 +143,7 @@ export abstract class SymbolNavigationAction extends EditorAction {
143
143
144
144
} else {
145
145
// normal results handling
146
- return this . _onResult ( editorService , symbolNavService , editor , references ) ;
146
+ return this . _onResult ( editorService , symbolNavService , editor , references , range ) ;
147
147
}
148
148
149
149
} , ( err ) => {
@@ -165,18 +165,18 @@ export abstract class SymbolNavigationAction extends EditorAction {
165
165
166
166
protected abstract _getGoToPreference ( editor : IActiveCodeEditor ) : GoToLocationValues ;
167
167
168
- private async _onResult ( editorService : ICodeEditorService , symbolNavService : ISymbolNavigationService , editor : IActiveCodeEditor , model : ReferencesModel ) : Promise < void > {
168
+ private async _onResult ( editorService : ICodeEditorService , symbolNavService : ISymbolNavigationService , editor : IActiveCodeEditor , model : ReferencesModel , range ?: Range ) : Promise < void > {
169
169
170
170
const gotoLocation = this . _getGoToPreference ( editor ) ;
171
171
if ( ! ( editor instanceof EmbeddedCodeEditorWidget ) && ( this . configuration . openInPeek || ( gotoLocation === 'peek' && model . references . length > 1 ) ) ) {
172
- this . _openInPeek ( editor , model ) ;
172
+ this . _openInPeek ( editor , model , range ) ;
173
173
174
174
} else {
175
175
const next = model . firstReference ( ) ! ;
176
176
const peek = model . references . length > 1 && gotoLocation === 'gotoAndPeek' ;
177
177
const targetEditor = await this . _openReference ( editor , editorService , next , this . configuration . openToSide , ! peek ) ;
178
178
if ( peek && targetEditor ) {
179
- this . _openInPeek ( targetEditor , model ) ;
179
+ this . _openInPeek ( targetEditor , model , range ) ;
180
180
} else {
181
181
model . dispose ( ) ;
182
182
}
@@ -229,10 +229,10 @@ export abstract class SymbolNavigationAction extends EditorAction {
229
229
return targetEditor ;
230
230
}
231
231
232
- private _openInPeek ( target : ICodeEditor , model : ReferencesModel ) {
232
+ private _openInPeek ( target : ICodeEditor , model : ReferencesModel , range ?: Range ) {
233
233
const controller = ReferencesController . get ( target ) ;
234
234
if ( controller && target . hasModel ( ) ) {
235
- controller . toggleWidget ( target . getSelection ( ) , createCancelablePromise ( _ => Promise . resolve ( model ) ) , this . configuration . openInPeek ) ;
235
+ controller . toggleWidget ( range ?? target . getSelection ( ) , createCancelablePromise ( _ => Promise . resolve ( model ) ) , this . configuration . openInPeek ) ;
236
236
} else {
237
237
model . dispose ( ) ;
238
238
}
0 commit comments