mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 08:15:56 +01:00
Refactor cloud delegation logic to clarify git repository requirement
This commit is contained in:
@@ -206,10 +206,10 @@ export class ChatContinueInSessionActionItem extends ActionWidgetDropdownActionV
|
||||
actions.push(this.toAction(AgentSessionProviders.Background, backgroundContrib, instantiationService, location));
|
||||
}
|
||||
|
||||
// Continue in Cloud (requires a git repository)
|
||||
// Continue in Cloud (disabled when no git repository)
|
||||
const cloudContrib = contributions.find(contrib => contrib.type === AgentSessionProviders.Cloud);
|
||||
if (cloudContrib && cloudContrib.canDelegate && hasGitRepo) {
|
||||
actions.push(this.toAction(AgentSessionProviders.Cloud, cloudContrib, instantiationService, location));
|
||||
if (cloudContrib && cloudContrib.canDelegate) {
|
||||
actions.push(this.toAction(AgentSessionProviders.Cloud, cloudContrib, instantiationService, location, hasGitRepo));
|
||||
}
|
||||
|
||||
// Offer actions to enter setup if we have no contributions
|
||||
@@ -223,13 +223,13 @@ export class ChatContinueInSessionActionItem extends ActionWidgetDropdownActionV
|
||||
};
|
||||
}
|
||||
|
||||
private static toAction(provider: AgentSessionProviders, contrib: ResolvedChatSessionsExtensionPoint, instantiationService: IInstantiationService, location: ActionLocation): IActionWidgetDropdownAction {
|
||||
private static toAction(provider: AgentSessionProviders, contrib: ResolvedChatSessionsExtensionPoint, instantiationService: IInstantiationService, location: ActionLocation, enabled: boolean = true): IActionWidgetDropdownAction {
|
||||
return {
|
||||
id: contrib.type,
|
||||
enabled: true,
|
||||
enabled,
|
||||
icon: getAgentSessionProviderIcon(provider),
|
||||
class: undefined,
|
||||
description: `@${contrib.name}`,
|
||||
description: enabled ? `@${contrib.name}` : localize('chat.cloudRequiresGit', "Requires a Git repository"),
|
||||
label: getAgentSessionProviderName(provider),
|
||||
tooltip: localize('continueSessionIn', "Continue in {0}", getAgentSessionProviderName(provider)),
|
||||
category: { label: localize('continueIn', "Continue In"), order: 0, showHeader: true },
|
||||
|
||||
@@ -107,11 +107,6 @@ export class DelegationSessionPickerActionItem extends SessionTypePickerActionIt
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cloud delegation requires a git repository
|
||||
if (type === AgentSessionProviders.Cloud && !this._hasGitRepository()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.delegate.getActiveSessionProvider() === type) {
|
||||
return true; // Always show active session type
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user