Sessions window: contributed pr actions

This commit is contained in:
Osvaldo Ortega
2026-03-04 15:45:55 -08:00
parent b3ad9079ba
commit 093376241c
2 changed files with 6 additions and 19 deletions

View File

@@ -184,18 +184,6 @@
}
],
"chat/input/editing/sessionApplyActions": [
{
"command": "github.createPullRequest",
"group": "navigation",
"order": 1,
"when": "isSessionsWindow && agentSessionHasChanges && chatSessionType == copilotcli && !github.hasOpenPullRequest"
},
{
"command": "github.openPullRequest",
"group": "navigation",
"order": 1,
"when": "isSessionsWindow && agentSessionHasChanges && chatSessionType == copilotcli && github.hasOpenPullRequest"
}
]
},
"configuration": [

View File

@@ -54,7 +54,6 @@ import { createFileIconThemableTreeContainerScope } from '../../../../workbench/
import { IActivityService, NumberBadge } from '../../../../workbench/services/activity/common/activity.js';
import { IEditorService, MODAL_GROUP, SIDE_GROUP } from '../../../../workbench/services/editor/common/editorService.js';
import { IExtensionService } from '../../../../workbench/services/extensions/common/extensions.js';
import { ICommandService } from '../../../../platform/commands/common/commands.js';
import { IWorkbenchLayoutService } from '../../../../workbench/services/layout/browser/layoutService.js';
import { ISessionsManagementService } from '../../sessions/browser/sessionsManagementService.js';
import { GITHUB_REMOTE_FILE_SCHEME } from '../../fileTreeView/browser/githubFileSystemProvider.js';
@@ -254,7 +253,6 @@ export class ChangesViewPane extends ViewPane {
@ISessionsManagementService private readonly sessionManagementService: ISessionsManagementService,
@ILabelService private readonly labelService: ILabelService,
@IStorageService private readonly storageService: IStorageService,
@ICommandService private readonly commandService: ICommandService,
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService);
@@ -561,12 +559,16 @@ export class ChangesViewPane extends ViewPane {
return files > 0;
}));
// Check if a PR exists when the active session changes
// Set context key for PR state from session metadata
const hasOpenPullRequestKey = scopedContextKeyService.createKey<boolean>('github.copilot.chat.copilotCLI.hasOpenPullRequest', false);
this.renderDisposables.add(autorun(reader => {
const sessionResource = activeSessionResource.read(reader);
sessionsChangedSignal.read(reader);
if (sessionResource) {
const metadata = this.agentSessionsService.getSession(sessionResource)?.metadata;
this.commandService.executeCommand('github.checkOpenPullRequest', sessionResource, metadata).catch(() => { /* ignore */ });
hasOpenPullRequestKey.set(!!metadata?.pullRequestUrl);
} else {
hasOpenPullRequestKey.set(false);
}
}));
@@ -592,9 +594,6 @@ export class ChangesViewPane extends ViewPane {
);
return { showIcon: true, showLabel: true, isSecondary: true, customClass: 'working-set-diff-stats', customLabel: diffStatsLabel };
}
if (action.id === 'github.createPullRequest' || action.id === 'github.openPullRequest') {
return { showIcon: true, showLabel: true, isSecondary: true };
}
if (action.id === 'chatEditing.synchronizeChanges') {
return { showIcon: true, showLabel: true, isSecondary: true };
}