From ac0c8d93ca7f69f7b168909a5d08822d23f26080 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:37:22 +0000 Subject: [PATCH] Sessions - remove the "Uncommitted Changes" from the changes view (#302848) --- .../contrib/changes/browser/changesView.ts | 73 +------------------ 1 file changed, 4 insertions(+), 69 deletions(-) diff --git a/src/vs/sessions/contrib/changes/browser/changesView.ts b/src/vs/sessions/contrib/changes/browser/changesView.ts index c7d7e3bcd4b..c7fd07a94e7 100644 --- a/src/vs/sessions/contrib/changes/browser/changesView.ts +++ b/src/vs/sessions/contrib/changes/browser/changesView.ts @@ -85,14 +85,12 @@ const changesViewModeContextKey = new RawContextKey('changesVie const enum ChangesVersionMode { AllChanges = 'allChanges', - LastTurn = 'lastTurn', - Uncommitted = 'uncommitted' + LastTurn = 'lastTurn' } const changesVersionModeContextKey = new RawContextKey('sessions.changesVersionMode', ChangesVersionMode.AllChanges); const isMergeBaseBranchProtectedContextKey = new RawContextKey('sessions.isMergeBaseBranchProtected', false); const hasOpenPullRequestContextKey = new RawContextKey('sessions.hasOpenPullRequest', false); -const hasUncommittedChangesContextKey = new RawContextKey('sessions.hasUncommittedChanges', false); // --- List Item @@ -256,7 +254,6 @@ export class ChangesViewPane extends ViewPane { private readonly activeSession: IObservableWithChange; private readonly activeSessionFileCountObs: IObservableWithChange; private readonly activeSessionHasChangesObs: IObservableWithChange; - private readonly activeSessionRepositoryChangesObs: IObservableWithChange; private readonly activeSessionRepositoryObs: IObservableWithChange; get activeSessionHasChanges(): IObservable { @@ -332,33 +329,6 @@ export class ChangesViewPane extends ViewPane { return activeSessionRepositoryPromise.read(reader); }); - this.activeSessionRepositoryChangesObs = derived(reader => { - const repository = this.activeSessionRepositoryObs.read(reader); - if (!repository) { - return undefined; - } - - const state = repository.state.read(reader); - const headCommit = state?.HEAD?.commit; - return (state?.workingTreeChanges ?? []).map(change => { - const isDeletion = change.modifiedUri === undefined; - const isAddition = change.originalUri === undefined; - const fileUri = change.modifiedUri ?? change.uri; - return { - type: 'file', - uri: fileUri, - originalUri: isDeletion || !headCommit ? change.originalUri - : fileUri.with({ scheme: 'git', query: JSON.stringify({ path: fileUri.fsPath, ref: headCommit }) }), - state: ModifiedFileEntryState.Accepted, - isDeletion, - changeType: isDeletion ? 'deleted' : isAddition ? 'added' : 'modified', - reviewCommentCount: 0, - linesAdded: 0, - linesRemoved: 0, - } satisfies IChangesFileItem; - }); - }); - this.activeSessionFileCountObs = this.createActiveSessionFileCountObservable(); this.activeSessionHasChangesObs = this.activeSessionFileCountObs.map(fileCount => fileCount > 0).recomputeInitiallyAndOnChange(this._store); @@ -632,13 +602,10 @@ export class ChangesViewPane extends ViewPane { const versionMode = this.versionModeObs.read(reader); const editEntries = editSessionEntriesObs.read(reader); const sessionFiles = sessionFilesObs.read(reader); - const repositoryFiles = this.activeSessionRepositoryChangesObs.read(reader) ?? []; const lastTurnDiffChanges = lastTurnChangesObs.read(reader).read(reader); let sourceEntries: IChangesFileItem[]; - if (versionMode === ChangesVersionMode.Uncommitted) { - sourceEntries = repositoryFiles; - } else if (versionMode === ChangesVersionMode.LastTurn) { + if (versionMode === ChangesVersionMode.LastTurn) { const diffChanges = lastTurnDiffChanges ?? []; const parentRef = headCommit ? `${headCommit}^` : ''; sourceEntries = diffChanges.map(change => { @@ -661,7 +628,7 @@ export class ChangesViewPane extends ViewPane { } satisfies IChangesFileItem; }); } else { - sourceEntries = [...editEntries, ...sessionFiles, ...repositoryFiles]; + sourceEntries = [...editEntries, ...sessionFiles]; } const resources = new Set(); @@ -679,7 +646,6 @@ export class ChangesViewPane extends ViewPane { const topLevelStats = derived(reader => { const editEntries = editSessionEntriesObs.read(reader); const sessionFiles = sessionFilesObs.read(reader); - const repositoryFiles = this.activeSessionRepositoryChangesObs.read(reader) ?? []; const entries = combinedEntriesObs.read(reader); let added = 0, removed = 0; @@ -690,7 +656,7 @@ export class ChangesViewPane extends ViewPane { } const files = entries.length; - const isSessionMenu = editEntries.length === 0 && (sessionFiles.length > 0 || repositoryFiles.length > 0); + const isSessionMenu = editEntries.length === 0 && sessionFiles.length > 0; return { files, added, removed, isSessionMenu }; }); @@ -735,13 +701,6 @@ export class ChangesViewPane extends ViewPane { this.renderDisposables.add(bindContextKey(ChatContextKeys.hasAgentSessionChanges, this.scopedContextKeyService, r => hasAgentSessionChangesObs.read(r))); - const hasUncommittedChangesObs = derived(reader => { - const repositoryFiles = this.activeSessionRepositoryChangesObs.read(reader); - return (repositoryFiles?.length ?? 0) > 0; - }); - - this.renderDisposables.add(bindContextKey(hasUncommittedChangesContextKey, this.scopedContextKeyService, r => hasUncommittedChangesObs.read(r))); - const isMergeBaseBranchProtectedObs = derived(reader => { const activeSession = this.activeSession.read(reader); return activeSession?.worktreeBaseBranchProtected === true; @@ -1443,27 +1402,3 @@ class LastTurnChangesAction extends Action2 { } } registerAction2(LastTurnChangesAction); - -class UncommittedChangesAction extends Action2 { - constructor() { - super({ - id: 'chatEditing.versionsUncommittedChanges', - title: localize2('chatEditing.versionsUncommittedChanges', 'Uncommitted Changes'), - category: CHAT_CATEGORY, - toggled: changesVersionModeContextKey.isEqualTo(ChangesVersionMode.Uncommitted), - precondition: hasUncommittedChangesContextKey, - menu: [{ - id: MenuId.ChatEditingSessionChangesVersionsSubmenu, - group: '2_uncommitted', - order: 1, - }], - }); - } - - override async run(accessor: ServicesAccessor): Promise { - const viewsService = accessor.get(IViewsService); - const view = viewsService.getActiveViewWithId(CHANGES_VIEW_ID); - view?.setVersionMode(ChangesVersionMode.Uncommitted); - } -} -registerAction2(UncommittedChangesAction);