File tree Expand file tree Collapse file tree
src/vs/sessions/contrib/changes/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change 58305830 "chat/input/editing/sessionChangeToolbar" : [
58315831 {
58325832 "command" : " github.copilot.sessions.discardChanges" ,
5833- "when" : " chatSessionType == copilotcli && isSessionsWindow && sessions.hasGitRepository && sessions.changesVersionMode == branchChanges && ! sessions.isAgentHostSession " ,
5833+ "when" : " chatSessionType == copilotcli && isSessionsWindow && sessions.hasGitRepository && ! sessions.isAgentHostSession && (sessions. changesVersionMode == branchChanges || sessions.changesVersionMode == uncommittedChanges) " ,
58345834 "group" : " navigation@2"
58355835 }
58365836 ],
Original file line number Diff line number Diff line change @@ -259,12 +259,26 @@ export class ChangesViewModel extends Disposable {
259259 } ) ;
260260
261261 // Uncommitted changes
262+ const activeSessionUncommittedChangesCountObs = derived ( reader => {
263+ const sessionMetadata = this . _activeSessionMetadataObs . read ( reader ) ;
264+ const uncommittedChanges = sessionMetadata ?. uncommittedChanges as number | undefined ;
265+
266+ const activeSession = this . sessionManagementService . activeSession . read ( reader ) ;
267+ const workspace = activeSession ?. workspace . read ( reader ) ;
268+ const workspaceRepository = workspace ?. repositories [ 0 ] ;
269+
270+ return uncommittedChanges ?? workspaceRepository ?. uncommittedChanges ;
271+ } ) ;
272+
262273 this . _activeSessionUncommittedChangesPromiseObs = derived ( reader => {
263274 const repositoryPath = activeSessionRepositoryPathObs . read ( reader ) ;
264275 if ( ! repositoryPath ) {
265276 return constObservable ( [ ] ) ;
266277 }
267278
279+ // Re-run when the number of uncommitted changes changes
280+ activeSessionUncommittedChangesCountObs . read ( reader ) ;
281+
268282 const diffPromise = this . _getRepositoryChanges ( repositoryPath , 'HEAD' , undefined ) ;
269283 return new ObservablePromise ( diffPromise ) . resolvedValue ;
270284 } ) ;
You can’t perform that action at this time.
0 commit comments