Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Done" action target #244813

Merged
merged 1 commit into from
Mar 27, 2025
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
18 changes: 3 additions & 15 deletions src/vs/workbench/contrib/chat/browser/actions/chatClearActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { EditingSessionAction } from '../chatEditing/chatEditingActions.js';
import { ctxIsGlobalEditingSession } from '../chatEditing/chatEditingEditorContextKeys.js';
import { ChatEditorInput } from '../chatEditorInput.js';
import { ChatViewPane } from '../chatViewPane.js';
import { CHAT_CATEGORY, getEditsViewId, handleCurrentEditingSession, IChatViewOpenOptions } from './chatActions.js';
import { CHAT_CATEGORY, handleCurrentEditingSession, IChatViewOpenOptions } from './chatActions.js';
import { clearChatEditor } from './chatClear.js';

export const ACTION_ID_NEW_CHAT = `workbench.action.chat.newChat`;
Expand Down Expand Up @@ -197,7 +197,7 @@ export function registerNewChatActions() {
}
});

registerAction2(class GlobalEditsDoneAction extends Action2 {
registerAction2(class GlobalEditsDoneAction extends EditingSessionAction {
constructor() {
super({
id: ChatDoneActionId,
Expand All @@ -214,31 +214,19 @@ export function registerNewChatActions() {
});
}

async run(accessor: ServicesAccessor, ...args: any[]) {
override async runEditingSessionAction(accessor: ServicesAccessor, editingSession: IChatEditingSession, widget: IChatWidget, ...args: any[]) {
const context = args[0];
const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
const widgetService = accessor.get(IChatWidgetService);
if (isChatViewTitleActionContext(context)) {
// Is running in the Chat view title
announceChatCleared(accessibilitySignalService);
const widget = widgetService.getWidgetBySessionId(context.sessionId);
if (widget) {
widget.clear();
widget.attachmentModel.clear();
widget.focusInput();
}
} else {
// Is running from f1 or keybinding
const viewsService = accessor.get(IViewsService);

const viewId = getEditsViewId(accessor);
const chatView = await viewsService.openView<ChatViewPane>(viewId);
if (!chatView) {
return;
}

const widget = chatView.widget;

announceChatCleared(accessibilitySignalService);
widget.clear();
widget.attachmentModel.clear();
Expand Down
Loading