Revert "wait for extension activation in getChatSessionContributions() (#259126)"

This reverts commit 38bf4ce891.
This commit is contained in:
Josh Spicer 2025-08-01 11:50:36 -07:00
parent ef385680fb
commit 3828c7d252
5 changed files with 12 additions and 16 deletions

View File

@ -567,7 +567,7 @@ export function registerChatActions() {
// Use the new Promise-based API to get chat sessions
const cancellationToken = new CancellationTokenSource();
try {
const providers = await chatSessionsService.getChatSessionContributions();
const providers = chatSessionsService.getChatSessionContributions();
const providerNSessions: { providerType: string; session: IChatSessionItem }[] = [];
for (const provider of providers) {

View File

@ -130,7 +130,7 @@ export class ChatEditor extends EditorPane {
if (input.resource.scheme === Schemas.vscodeChatSession) {
const identifier = ChatSessionUri.parse(input.resource);
if (identifier) {
const contributions = await this.chatSessionsService.getChatSessionContributions([input.resource.authority]);
const contributions = this.chatSessionsService.getChatSessionContributions();
const contribution = contributions.find(c => c.type === identifier.chatSessionType);
if (contribution) {
this.widget.lockToCodingAgent(contribution.name, contribution.displayName);

View File

@ -295,11 +295,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
return disposable;
}
async getChatSessionContributions(waitForActivation?: string[]): Promise<IChatSessionsExtensionPoint[]> {
await this._extensionService.whenInstalledExtensionsRegistered();
if (waitForActivation) {
await Promise.all(waitForActivation.map(id => this._extensionService.activateByEvent(`onChatSession:${id}`)));
}
getChatSessionContributions(): IChatSessionsExtensionPoint[] {
return Array.from(this._contributions.values()).filter(contribution =>
this._isContributionAvailable(contribution)
);

View File

@ -715,8 +715,8 @@ class SessionsViewPane extends ViewPane {
}
}
private async getProviderDisplayName(): Promise<string> {
const contributions = await this.chatSessionsService.getChatSessionContributions();
private getProviderDisplayName(): string {
const contributions = this.chatSessionsService.getChatSessionContributions();
const contribution = contributions.find(c => c.type === this.provider.chatSessionType);
if (contribution) {
return contribution.displayName;
@ -724,7 +724,7 @@ class SessionsViewPane extends ViewPane {
return '';
}
private async showEmptyMessage(): Promise<void> {
private showEmptyMessage(): void {
if (!this.messageElement) {
return;
}
@ -735,7 +735,7 @@ class SessionsViewPane extends ViewPane {
return;
}
const providerName = await this.getProviderDisplayName();
const providerName = this.getProviderDisplayName();
if (!providerName) {
return;
}
@ -775,7 +775,7 @@ class SessionsViewPane extends ViewPane {
* Updates the empty state message based on current tree data.
* Uses the tree's existing data to avoid redundant provider calls.
*/
private async updateEmptyStateMessage(): Promise<void> {
private updateEmptyStateMessage(): void {
try {
// Check if the tree has the provider node and get its children count
if (this.tree?.hasNode(this.provider)) {
@ -783,7 +783,7 @@ class SessionsViewPane extends ViewPane {
const childCount = providerNode.children?.length || 0;
if (childCount === 0) {
await this.showEmptyMessage();
this.showEmptyMessage();
} else {
this.hideMessage();
}
@ -814,7 +814,7 @@ class SessionsViewPane extends ViewPane {
);
// Check for empty state after refresh using tree data
await this.updateEmptyStateMessage();
this.updateEmptyStateMessage();
} catch (error) {
// Log error but don't throw to avoid breaking the UI
this.logService.error('Error refreshing chat sessions tree:', error);
@ -842,7 +842,7 @@ class SessionsViewPane extends ViewPane {
);
// Check for empty state after loading using tree data
await this.updateEmptyStateMessage();
this.updateEmptyStateMessage();
} catch (error) {
// Log error but don't throw to avoid breaking the UI
this.logService.error('Error loading chat sessions data:', error);

View File

@ -68,7 +68,7 @@ export interface IChatSessionsService {
readonly onDidChangeSessionItems: Event<string>;
readonly onDidChangeAvailability: Event<void>;
registerContribution(contribution: IChatSessionsExtensionPoint): IDisposable;
getChatSessionContributions(waitForActivation?: string[]): Promise<IChatSessionsExtensionPoint[]>;
getChatSessionContributions(): IChatSessionsExtensionPoint[];
canResolveItemProvider(chatSessionType: string): Promise<boolean>;
canResolveContentProvider(chatSessionType: string): Promise<boolean>;
getChatSessionItemProviders(): IChatSessionItemProvider[];