mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
Merge pull request #299327 from microsoft/osortega/squealing-flamingo
Sessions window: contributed pr actions
This commit is contained in:
@@ -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": [
|
||||
|
||||
@@ -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,18 +559,23 @@ 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>('sessions.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);
|
||||
}
|
||||
}));
|
||||
|
||||
this.renderDisposables.add(autorun(reader => {
|
||||
const { isSessionMenu, added, removed } = topLevelStats.read(reader);
|
||||
const sessionResource = activeSessionResource.read(reader);
|
||||
sessionsChangedSignal.read(reader); // Re-evaluate when session metadata changes (e.g. pullRequestUrl)
|
||||
const menuId = isSessionMenu ? MenuId.ChatEditingSessionChangesToolbar : MenuId.ChatEditingWidgetToolbar;
|
||||
|
||||
reader.store.add(scopedInstantiationService.createInstance(
|
||||
@@ -581,6 +584,7 @@ export class ChangesViewPane extends ViewPane {
|
||||
menuId,
|
||||
{
|
||||
telemetrySource: 'changesView',
|
||||
disableWhileRunning: isSessionMenu,
|
||||
menuOptions: isSessionMenu && sessionResource
|
||||
? { args: [sessionResource, this.agentSessionsService.getSession(sessionResource)?.metadata] }
|
||||
: { shouldForwardArgs: true },
|
||||
@@ -592,9 +596,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 };
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
.changes-view-body .chat-editing-session-actions.outside-card .monaco-button {
|
||||
height: 26px;
|
||||
padding: 4px 14px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user