mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
honor when clause for chatSession contibution in agent sessions filter (#294283)
This commit is contained in:
@@ -11,7 +11,7 @@ import { registerAction2, Action2, MenuId } from '../../../../../platform/action
|
||||
import { ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
|
||||
import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
|
||||
import { IChatSessionsService } from '../../common/chatSessionsService.js';
|
||||
import { AgentSessionProviders, getAgentSessionProviderName } from './agentSessions.js';
|
||||
import { AgentSessionProviders, getAgentSessionProvider, getAgentSessionProviderName } from './agentSessions.js';
|
||||
import { AgentSessionStatus, IAgentSession } from './agentSessionsModel.js';
|
||||
import { IAgentSessionsFilter, IAgentSessionsFilterExcludes } from './agentSessionsViewer.js';
|
||||
|
||||
@@ -127,17 +127,21 @@ export class AgentSessionsFilter extends Disposable implements Required<IAgentSe
|
||||
}
|
||||
|
||||
private registerProviderActions(disposables: DisposableStore, menuId: MenuId): void {
|
||||
const providers: { id: string; label: string }[] = Object.values(AgentSessionProviders).map(provider => ({
|
||||
id: provider,
|
||||
label: getAgentSessionProviderName(provider)
|
||||
}));
|
||||
const providers: { id: string; label: string }[] = [{
|
||||
id: AgentSessionProviders.Local,
|
||||
label: getAgentSessionProviderName(AgentSessionProviders.Local)
|
||||
}];
|
||||
|
||||
for (const provider of this.chatSessionsService.getAllChatSessionContributions()) {
|
||||
if (providers.find(p => p.id === provider.type)) {
|
||||
for (const contribution of this.chatSessionsService.getAllChatSessionContributions()) {
|
||||
if (providers.find(p => p.id === contribution.type)) {
|
||||
continue; // already added
|
||||
}
|
||||
|
||||
providers.push({ id: provider.type, label: provider.name });
|
||||
const knownProvider = getAgentSessionProvider(contribution.type);
|
||||
providers.push({
|
||||
id: contribution.type,
|
||||
label: knownProvider ? getAgentSessionProviderName(knownProvider) : contribution.displayName
|
||||
});
|
||||
}
|
||||
|
||||
const that = this;
|
||||
|
||||
@@ -333,7 +333,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
||||
const builtinSessionProviders = [AgentSessionProviders.Local];
|
||||
const contributedSessionProviders = observableFromEvent(
|
||||
this.onDidChangeAvailability,
|
||||
() => Array.from(this._contributions.keys()).filter(isAgentSessionProviderType) as AgentSessionProviders[],
|
||||
() => Array.from(this._contributions.keys()).filter(key => this._contributionDisposables.has(key) && isAgentSessionProviderType(key)) as AgentSessionProviders[],
|
||||
).recomputeInitiallyAndOnChange(this._store);
|
||||
|
||||
this._register(autorun(reader => {
|
||||
@@ -371,8 +371,6 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
||||
displayName = localize('chat.session.inProgress.background', "Background Agent");
|
||||
} else if (chatSessionType === AgentSessionProviders.Cloud) {
|
||||
displayName = localize('chat.session.inProgress.cloud', "Cloud Agent");
|
||||
} else if (chatSessionType === AgentSessionProviders.Growth) {
|
||||
displayName = localize('chat.session.inProgress.growth', "Growth");
|
||||
} else {
|
||||
displayName = this._contributions.get(chatSessionType)?.contribution.displayName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user