1- import { Memento , Position , Uri , commands } from 'vscode' ;
1+ import { Memento , Position , Uri , commands , window } from 'vscode' ;
22import { OutlineView } from './outline' ;
33import { config } from './config' ;
44import { ChangeDepthMsg , FocusMsg , PinSMsg , PinStatus , Sortby } from '../common' ;
@@ -199,4 +199,39 @@ export const WorkspaceCommandList: Command[] = [
199199 name : 'outline-map.workspace.goToLocation' ,
200200 fn : workspaceGotoLocation ,
201201 } ,
202+ ] ;
203+
204+ // export
205+ const goToLocation = ( { pos} : { pos : Position } ) => {
206+ const uri = window . activeTextEditor ?. document . uri ;
207+ commands . executeCommand ( 'editor.action.goToLocations' , uri , new Position ( pos . line , pos . character ) , [ ] , 'goto' , '' ) ;
208+ } ;
209+
210+ // export
211+ const showReferences = ( arg : { pos : Position } ) => {
212+ commands . executeCommand ( 'outline-map.context.goToLocation' , arg ) . then ( ( ) => {
213+ commands . executeCommand ( 'editor.action.referenceSearch.trigger' ) ;
214+ } ) ;
215+ } ;
216+
217+ const showCallHierarchy = ( arg : { pos : Position } ) => {
218+ commands . executeCommand ( 'outline-map.context.goToLocation' , arg ) . then ( ( ) => {
219+ commands . executeCommand ( 'editor.showCallHierarchy' ) ;
220+ } ) ;
221+ } ;
222+
223+
224+ export const ContextCommandList : Command [ ] = [
225+ {
226+ name : 'outline-map.context.goToLocation' ,
227+ fn : goToLocation ,
228+ } ,
229+ {
230+ name : 'outline-map.context.showReferences' ,
231+ fn : showReferences ,
232+ } ,
233+ {
234+ name : 'outline-map.context.showCallHierarchy' ,
235+ fn : showCallHierarchy ,
236+ } ,
202237] ;
0 commit comments