11import type { Disposable , TextDocument } from 'vscode' ;
2- import { workspace } from 'vscode' ;
2+ import { ViewColumn , workspace } from 'vscode' ;
33import { getAvatarUri , getAvatarUriFromGravatarEmail } from '../../avatars' ;
44import type { RebaseEditorTelemetryContext } from '../../constants.telemetry' ;
55import type { Container } from '../../container' ;
@@ -30,7 +30,7 @@ import type { ComposerWebviewShowingArgs } from '../plus/composer/registration';
3030import type { ShowInCommitGraphCommandArgs } from '../plus/graph/registration' ;
3131import type { IpcMessage } from '../protocol' ;
3232import type { WebviewHost } from '../webviewProvider' ;
33- import type { WebviewPanelShowCommandArgs , WebviewShowOptions } from '../webviewsController' ;
33+ import type { WebviewPanelShowCommandArgs } from '../webviewsController' ;
3434import type {
3535 Author ,
3636 ChangeEntriesParams ,
@@ -197,14 +197,6 @@ export class RebaseWebviewProvider implements Disposable {
197197 ] ;
198198 }
199199
200- onShowing ( loading : boolean , _options : WebviewShowOptions ) : [ boolean , undefined ] {
201- // Reveal branch tip on initial load if behavior is 'onOpen'
202- if ( loading ) {
203- void this . revealBranchTipOnOpen ( ) ;
204- }
205- return [ true , undefined ] ;
206- }
207-
208200 onMessageReceived ( e : IpcMessage ) : void {
209201 switch ( true ) {
210202 case AbortCommand . is ( e ) :
@@ -525,13 +517,21 @@ export class RebaseWebviewProvider implements Disposable {
525517 name : params . ref ,
526518 remote : false ,
527519 } ) ;
528- await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , { ref : ref } ) ;
520+ await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , {
521+ ref : ref ,
522+ preserveFocus : true ,
523+ viewColumn : ViewColumn . Beside ,
524+ } ) ;
529525 return ;
530526 }
531527
532528 const ref = createReference ( params . ref , this . repoPath , { refType : 'revision' } ) ;
533529 if ( revealIn === 'graph' ) {
534- await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , { ref : ref } ) ;
530+ await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , {
531+ ref : ref ,
532+ preserveFocus : true ,
533+ viewColumn : ViewColumn . Beside ,
534+ } ) ;
535535 } else {
536536 await this . container . views . commitDetails . show ( { preserveFocus : true } , { commit : ref } ) ;
537537 }
@@ -543,8 +543,18 @@ export class RebaseWebviewProvider implements Disposable {
543543 void this . fireSelectionChangedDebounced ( params ) ;
544544 }
545545
546- private async fireSelectionChanged ( params : UpdateSelectionParams ) : Promise < void > {
546+ private getRevealBehavior ( ) {
547547 const revealBehavior = configuration . get ( 'rebaseEditor.revealBehavior' ) ;
548+ // Handle deprecated 'never' and 'onOpen' behavior
549+ if ( ( revealBehavior as string ) === 'onOpen' || ( revealBehavior as string ) === 'never' ) {
550+ return 'onDoubleClick' ;
551+ }
552+
553+ return revealBehavior ;
554+ }
555+
556+ private async fireSelectionChanged ( params : UpdateSelectionParams ) : Promise < void > {
557+ const revealBehavior = this . getRevealBehavior ( ) ;
548558 // Only auto-reveal on selection if behavior is 'onSelection'
549559 if ( revealBehavior !== 'onSelection' ) return ;
550560
@@ -565,7 +575,11 @@ export class RebaseWebviewProvider implements Disposable {
565575 const revealLocation = configuration . get ( 'rebaseEditor.revealLocation' ) ;
566576 if ( revealLocation === 'graph' ) {
567577 const ref = createReference ( commit . sha , this . repoPath , { refType : 'revision' } ) ;
568- await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , { ref : ref } ) ;
578+ await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , {
579+ ref : ref ,
580+ preserveFocus : true ,
581+ viewColumn : ViewColumn . Beside ,
582+ } ) ;
569583 } else {
570584 // Fire event for commit details view to pick up
571585 this . container . events . fire (
@@ -637,7 +651,7 @@ export class RebaseWebviewProvider implements Disposable {
637651 ascending : this . ascending ,
638652 isReadOnly : processed . preservesMerges ,
639653 revealLocation : configuration . get ( 'rebaseEditor.revealLocation' ) ,
640- revealBehavior : configuration . get ( 'rebaseEditor.revealBehavior' ) ,
654+ revealBehavior : this . getRevealBehavior ( ) ,
641655 rebaseStatus : rebaseStatus ,
642656 repoPath : this . repoPath ,
643657 subscription : subscription ,
@@ -736,34 +750,6 @@ export class RebaseWebviewProvider implements Disposable {
736750 } ;
737751 }
738752
739- private async revealBranchTipOnOpen ( ) : Promise < void > {
740- const revealBehavior = configuration . get ( 'rebaseEditor.revealBehavior' ) ;
741- if ( revealBehavior !== 'onOpen' ) return ;
742-
743- const revealLocation = configuration . get ( 'rebaseEditor.revealLocation' ) ;
744- const branchName =
745- this . _branchName ??
746- ( await this . container . git . getRepositoryService ( this . repoPath ) . branches . getBranch ( ) ) ?. name ;
747- if ( branchName == null ) return ;
748-
749- const ref = createReference ( branchName , this . repoPath , { refType : 'branch' , name : branchName , remote : false } ) ;
750-
751- if ( revealLocation === 'graph' ) {
752- await executeCommand < ShowInCommitGraphCommandArgs > ( 'gitlens.showInCommitGraph' , { ref : ref } ) ;
753- } else {
754- // For inspect view, get the branch tip commit
755- const branch = await this . container . git . getRepositoryService ( this . repoPath ) . branches . getBranch ( branchName ) ;
756- if ( branch ?. sha != null ) {
757- const commit = await this . container . git
758- . getRepositoryService ( this . repoPath )
759- . commits . getCommit ( branch . sha ) ;
760- if ( commit != null ) {
761- await this . container . views . commitDetails . show ( { preserveFocus : true } , { commit : commit } ) ;
762- }
763- }
764- }
765- }
766-
767753 private notifyDidChangeAvatars ( ) : void {
768754 if ( ! this . _enrichment ?. authors . size || ! this . host . visible ) return ;
769755
0 commit comments