File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,6 +336,10 @@ export class WorkbenchEditorServiceImpl extends WithEventBus implements Workbenc
336336 return this . _currentEditorGroup as any ;
337337 }
338338
339+ public get currentOrPreviousFocusedEditor ( ) : IEditor | null {
340+ return this . currentEditorGroup && this . currentEditorGroup . currentOrPreviousFocusedEditor ;
341+ }
342+
339343 async open ( uri : URI , options ?: IResourceOpenOptions ) {
340344 await this . initialize ( ) ;
341345 let group = this . currentEditorGroup ;
Original file line number Diff line number Diff line change @@ -346,6 +346,11 @@ export abstract class WorkbenchEditorService {
346346 */
347347 currentEditor : IEditor | null ;
348348
349+ /**
350+ * 和 currentEditor 不同,对于 DiffEditor 来说会取到上一次 focus 的 Editor
351+ */
352+ currentOrPreviousFocusedEditor : IEditor | null ;
353+
349354 /**
350355 * 当前焦点的编辑器资源
351356 */
Original file line number Diff line number Diff line change @@ -579,7 +579,7 @@ export class ContentSearchClientService extends Disposable implements IContentSe
579579 } ;
580580
581581 searchEditorSelection = ( ) => {
582- const currentEditor = this . workbenchEditorService . currentEditor ;
582+ const currentEditor = this . workbenchEditorService . currentOrPreviousFocusedEditor ;
583583 if ( currentEditor ) {
584584 const selections = currentEditor . getSelections ( ) ;
585585 if ( selections && selections . length > 0 && currentEditor . currentDocumentModel ) {
You can’t perform that action at this time.
0 commit comments