Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export class CopilotCLIChatSessionContentProvider extends Disposable implements
}
}
));
const inputStateForNewSession = new ResourceMap<WeakRef<vscode.ChatSessionInputState>>();
controller.newChatSessionItemHandler = async (context) => {
const sessionId = this.sessionService.createNewSessionId();
const resource = SessionIdForCLI.getResource(sessionId);
Expand All @@ -185,8 +184,6 @@ export class CopilotCLIChatSessionContentProvider extends Disposable implements

controller.items.add(session);
this.newSessions.set(resource, session);
const groups = await this._optionGroupBuilder.provideChatSessionProviderOptionGroups(context.inputState);
inputStateForNewSession.set(resource, new WeakRef(controller.createChatSessionInputState(groups)));
return session;
};
if (this.configurationService.getConfig(ConfigKey.Advanced.CLIForkSessionsEnabled)) {
Expand Down Expand Up @@ -249,12 +246,7 @@ export class CopilotCLIChatSessionContentProvider extends Disposable implements
const groups = await this._optionGroupBuilder.buildExistingSessionInputStateGroups(sessionResource, token);
return controller.createChatSessionInputState(groups);
} else {
Comment thread
DonJayamanne marked this conversation as resolved.
// Possible we've already handled the newChatSessionItemHandler for this same uri
// In which case the proper inputState would have been sent.
// There's a bug in core where after newChatSessionItemHandler is called, we get
// another call for getChatSessionInputState, but this time the previous input state is incorrect.
const previousInputState = sessionResource ? inputStateForNewSession.get(sessionResource)?.deref() : undefined;
const groups = await this._optionGroupBuilder.provideChatSessionProviderOptionGroups(previousInputState);
const groups = await this._optionGroupBuilder.provideChatSessionProviderOptionGroups(context.previousInputState);
Comment thread
DonJayamanne marked this conversation as resolved.
const state = controller.createChatSessionInputState(groups);
// Only wire dynamic updates for new sessions (existing sessions are fully locked).
// Note: don't use the getChatSessionInputState token here — it's a one-shot token
Expand Down
Loading