@@ -6,6 +6,7 @@ import type { GitPausedOperationStatus } from '../../git/models/pausedOperationS
66import type { GitStatus } from '../../git/models/status' ;
77import { pausedOperationStatusStringsByType } from '../../git/utils/pausedOperationStatus.utils' ;
88import { getReferenceLabel } from '../../git/utils/reference.utils' ;
9+ import { Lazy } from '../../system/lazy' ;
910import { pluralize } from '../../system/string' ;
1011import type { ViewsWithCommits } from '../viewBase' ;
1112import { createViewDecorationUri } from '../viewDecorationProvider' ;
@@ -14,29 +15,44 @@ import { MergeConflictFilesNode } from './mergeConflictFilesNode';
1415import { RebaseCommitNode } from './rebaseCommitNode' ;
1516
1617export class PausedOperationStatusNode extends ViewNode < 'paused-operation-status' , ViewsWithCommits > {
18+ private _status : GitStatus | undefined ;
19+ private readonly _lazyStatus : Lazy < GitStatus | Promise < GitStatus | undefined > | undefined > ;
20+
1721 constructor (
1822 view : ViewsWithCommits ,
1923 protected override readonly parent : ViewNode ,
2024 public readonly branch : GitBranch ,
2125 public readonly pausedOpStatus : GitPausedOperationStatus ,
22- public readonly status : GitStatus | undefined ,
2326 // Specifies that the node is shown as a root
2427 public readonly root : boolean ,
28+ status ?: GitStatus | undefined ,
2529 ) {
2630 super ( 'paused-operation-status' , GitUri . fromRepoPath ( pausedOpStatus . repoPath ) , view , parent ) ;
2731
2832 this . updateContext ( { branch : branch , root : root , pausedOperation : pausedOpStatus . type } ) ;
2933 this . _uniqueId = getViewNodeId ( this . type , this . context ) ;
34+
35+ this . _status = status ;
36+ this . _lazyStatus = new Lazy < GitStatus | Promise < GitStatus | undefined > | undefined > (
37+ ( ) =>
38+ status ??
39+ this . view . container . git
40+ . getRepositoryService ( this . repoPath )
41+ . status . getStatus ( )
42+ . then ( s => ( this . _status = s ) ) ,
43+ ) ;
3044 }
3145
3246 get repoPath ( ) : string {
3347 return this . uri . repoPath ! ;
3448 }
3549
3650 async getChildren ( ) : Promise < ViewNode [ ] > {
51+ const status = await this . _lazyStatus . value ;
52+
3753 if ( this . pausedOpStatus . type !== 'rebase' ) {
38- return this . status ?. hasConflicts
39- ? [ new MergeConflictFilesNode ( this . view , this , this . pausedOpStatus , this . status . conflicts ) ]
54+ return status ?. hasConflicts
55+ ? [ new MergeConflictFilesNode ( this . view , this , this . pausedOpStatus , status . conflicts ) ]
4056 : [ ] ;
4157 }
4258
@@ -55,17 +71,19 @@ export class PausedOperationStatusNode extends ViewNode<'paused-operation-status
5571 }
5672 }
5773
58- if ( this . status ?. hasConflicts ) {
59- children . push ( new MergeConflictFilesNode ( this . view , this , this . pausedOpStatus , this . status . conflicts ) ) ;
74+ if ( status ?. hasConflicts ) {
75+ children . push ( new MergeConflictFilesNode ( this . view , this , this . pausedOpStatus , status . conflicts ) ) ;
6076 }
6177
6278 return children ;
6379 }
6480
65- getTreeItem ( ) : TreeItem {
66- const hasConflicts = this . status ?. hasConflicts === true ;
81+ async getTreeItem ( ) : Promise < TreeItem > {
82+ const status = await this . _lazyStatus . value ;
83+
84+ const hasConflicts = status ?. hasConflicts === true ;
6785 const hasChildren =
68- this . status ?. hasConflicts ||
86+ status ?. hasConflicts ||
6987 ( this . pausedOpStatus . type === 'rebase' &&
7088 this . pausedOpStatus . steps . total > 0 &&
7189 this . pausedOpStatus . steps . current . commit != null ) ;
@@ -91,7 +109,7 @@ export class PausedOperationStatusNode extends ViewNode<'paused-operation-status
91109 break ;
92110 }
93111
94- item . description = hasConflicts ? pluralize ( 'conflict' , this . status . conflicts . length ) : undefined ;
112+ item . description = hasConflicts ? pluralize ( 'conflict' , status . conflicts . length ) : undefined ;
95113
96114 const iconColor : Colors = hasConflicts
97115 ? 'gitlens.decorations.statusMergingOrRebasingConflictForegroundColor'
@@ -108,7 +126,7 @@ export class PausedOperationStatusNode extends ViewNode<'paused-operation-status
108126 }
109127
110128 private get label ( ) : string {
111- const hasConflicts = this . status ?. hasConflicts === true ;
129+ const hasConflicts = this . _status ?. hasConflicts === true ;
112130
113131 if ( this . pausedOpStatus . type !== 'rebase' ) {
114132 const strings = pausedOperationStatusStringsByType [ this . pausedOpStatus . type ] ;
@@ -136,17 +154,16 @@ export class PausedOperationStatusNode extends ViewNode<'paused-operation-status
136154 }
137155
138156 private get tooltip ( ) : MarkdownString {
139- const hasConflicts = this . status ?. hasConflicts === true ;
157+ const status = this . _status ;
158+ const hasConflicts = status ?. hasConflicts === true ;
140159
141160 let tooltip ;
142161 if ( this . pausedOpStatus . type !== 'rebase' ) {
143162 const strings = pausedOperationStatusStringsByType [ this . pausedOpStatus . type ] ;
144163 tooltip = `${ strings . label } ${ getReferenceLabel ( this . pausedOpStatus . incoming , { label : false } ) } ${
145164 strings . directionality
146165 } ${ getReferenceLabel ( this . pausedOpStatus . current , { label : false } ) } ${
147- hasConflicts
148- ? `\n\nResolve ${ pluralize ( 'conflict' , this . status . conflicts . length ) } before continuing`
149- : ''
166+ hasConflicts ? `\n\nResolve ${ pluralize ( 'conflict' , status . conflicts . length ) } before continuing` : ''
150167 } `;
151168 } else {
152169 const started = this . pausedOpStatus . steps . total > 0 ;
@@ -161,7 +178,7 @@ export class PausedOperationStatusNode extends ViewNode<'paused-operation-status
161178 this . pausedOpStatus . steps . total
162179 } ${
163180 hasConflicts
164- ? `\\\nResolve ${ pluralize ( 'conflict' , this . status . conflicts . length ) } before continuing`
181+ ? `\\\nResolve ${ pluralize ( 'conflict' , status . conflicts . length ) } before continuing`
165182 : ''
166183 } `
167184 : ''
0 commit comments