@@ -332,21 +332,37 @@ CommandsRegistry.registerCommand({
332332
333333CommandsRegistry . registerCommand ( {
334334 id : Constants . RevealInSideBarForSearchResults ,
335- handler : ( accessor , fileMatch : FileMatch ) => {
335+ handler : ( accessor , args : any ) => {
336336 const viewletService = accessor . get ( IViewletService ) ;
337337 const explorerService = accessor . get ( IExplorerService ) ;
338338 const contextService = accessor . get ( IWorkspaceContextService ) ;
339- const uri = fileMatch . resource ;
339+
340+ const searchView = getSearchView ( accessor . get ( IViewsService ) ) ;
341+ if ( ! searchView ) {
342+ return ;
343+ }
344+
345+ let fileMatch : FileMatch ;
346+ if ( ! ( args instanceof FileMatch ) ) {
347+ args = searchView . getControl ( ) . getFocus ( ) [ 0 ] ;
348+ }
349+ if ( args instanceof FileMatch ) {
350+ fileMatch = args ;
351+ } else {
352+ return ;
353+ }
340354
341355 viewletService . openViewlet ( VIEWLET_ID_FILES , false ) . then ( ( viewlet ) => {
342- const explorerViewContainer = viewlet ?. getViewPaneContainer ( ) as ExplorerViewPaneContainer ;
356+ if ( ! viewlet ) {
357+ return ;
358+ }
343359
360+ const explorerViewContainer = viewlet . getViewPaneContainer ( ) as ExplorerViewPaneContainer ;
361+ const uri = fileMatch . resource ;
344362 if ( uri && contextService . isInsideWorkspace ( uri ) ) {
345- const explorerView = explorerViewContainer ?. getExplorerView ( ) ;
346- if ( explorerView ) {
347- explorerView . setExpanded ( true ) ;
348- explorerService . select ( uri , true ) . then ( ( ) => explorerView . focus ( ) , onUnexpectedError ) ;
349- }
363+ const explorerView = explorerViewContainer . getExplorerView ( ) ;
364+ explorerView . setExpanded ( true ) ;
365+ explorerService . select ( uri , true ) . then ( ( ) => explorerView . focus ( ) , onUnexpectedError ) ;
350366 }
351367 } ) ;
352368 }
0 commit comments