mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
inline chat fixes (#229973)
* disposing the editor view should remove overflowing overlay widgets node * use a suitable overflow widget dom node for the inline chat widget fixes https://github.com/microsoft/vscode-internalbacklog/issues/4298 fixes (doesn't re-introduce) https://github.com/microsoft/vscode-copilot/issues/8701 * * make sure `ESC` first closes suggest before closing inline chat * also remove duplicated action
This commit is contained in:
@@ -92,7 +92,6 @@ registerAction2(InlineChatActions.CloseAction);
|
||||
registerAction2(InlineChatActions.ConfigureInlineChatAction);
|
||||
registerAction2(InlineChatActions.UnstashSessionAction);
|
||||
registerAction2(InlineChatActions.DiscardHunkAction);
|
||||
registerAction2(InlineChatActions.DiscardAction);
|
||||
registerAction2(InlineChatActions.RerunAction);
|
||||
registerAction2(InlineChatActions.MoveToNextHunk);
|
||||
registerAction2(InlineChatActions.MoveToPreviousHunk);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { EmbeddedDiffEditorWidget } from '../../../../editor/browser/widget/diff
|
||||
import { EmbeddedCodeEditorWidget } from '../../../../editor/browser/widget/codeEditor/embeddedCodeEditorWidget.js';
|
||||
import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
|
||||
import { InlineChatController, InlineChatRunOptions } from './inlineChatController.js';
|
||||
import { ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_EDIT_MODE, EditMode, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, InlineChatResponseType, ACTION_REGENERATE_RESPONSE, ACTION_VIEW_IN_CHAT, ACTION_TOGGLE_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, MENU_INLINE_CHAT_ZONE, ACTION_DISCARD_CHANGES, CTX_INLINE_CHAT_POSSIBLE } from '../common/inlineChat.js';
|
||||
import { ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_EDIT_MODE, EditMode, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_RESPONSE_TYPE, InlineChatResponseType, ACTION_REGENERATE_RESPONSE, ACTION_VIEW_IN_CHAT, ACTION_TOGGLE_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, MENU_INLINE_CHAT_ZONE, ACTION_DISCARD_CHANGES, CTX_INLINE_CHAT_POSSIBLE } from '../common/inlineChat.js';
|
||||
import { localize, localize2 } from '../../../../nls.js';
|
||||
import { Action2, IAction2Options, MenuId } from '../../../../platform/actions/common/actions.js';
|
||||
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
|
||||
@@ -235,27 +235,6 @@ export class FocusInlineChat extends EditorAction2 {
|
||||
}
|
||||
|
||||
|
||||
export class DiscardAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'inlineChat.discard',
|
||||
title: localize('discard', 'Discard'),
|
||||
icon: Codicon.discard,
|
||||
precondition: CTX_INLINE_CHAT_VISIBLE,
|
||||
keybinding: {
|
||||
weight: KeybindingWeight.EditorContrib - 1,
|
||||
primary: KeyCode.Escape,
|
||||
when: CTX_INLINE_CHAT_USER_DID_EDIT.negate()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
|
||||
await ctrl.cancelSession();
|
||||
}
|
||||
}
|
||||
|
||||
export class AcceptChanges extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
@@ -316,7 +295,7 @@ export class DiscardHunkAction extends AbstractInlineChatAction {
|
||||
order: 2
|
||||
}],
|
||||
keybinding: {
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
primary: KeyCode.Escape,
|
||||
when: CTX_INLINE_CHAT_RESPONSE_TYPE.isEqualTo(InlineChatResponseType.MessagesAndEdits)
|
||||
}
|
||||
@@ -374,7 +353,7 @@ export class CloseAction extends AbstractInlineChatAction {
|
||||
icon: Codicon.close,
|
||||
precondition: CTX_INLINE_CHAT_VISIBLE,
|
||||
keybinding: {
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
weight: KeybindingWeight.EditorContrib + 1,
|
||||
primary: KeyCode.Escape,
|
||||
},
|
||||
menu: [{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Dimension, getActiveElement, getTotalHeight, h, reset, trackFocus } from '../../../../base/browser/dom.js';
|
||||
import { $, Dimension, getActiveElement, getTotalHeight, h, reset, trackFocus } from '../../../../base/browser/dom.js';
|
||||
import { IActionViewItemOptions } from '../../../../base/browser/ui/actionbar/actionViewItems.js';
|
||||
import { getDefaultHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegateFactory.js';
|
||||
import { renderLabelWithIcons } from '../../../../base/browser/ui/iconLabel/iconLabels.js';
|
||||
@@ -54,6 +54,7 @@ import { isResponseVM } from '../../chat/common/chatViewModel.js';
|
||||
import { HunkInformation, Session } from './inlineChatSession.js';
|
||||
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED, inlineChatBackground, inlineChatForeground } from '../common/inlineChat.js';
|
||||
import { EDITOR_DRAG_AND_DROP_BACKGROUND } from '../../../common/theme.js';
|
||||
import { ILayoutService } from '../../../../platform/layout/browser/layoutService.js';
|
||||
|
||||
|
||||
export interface InlineChatWidgetViewState {
|
||||
@@ -570,6 +571,7 @@ export class EditorBasedInlineChatWidget extends InlineChatWidget {
|
||||
|
||||
private readonly _accessibleViewer = this._store.add(new MutableDisposable<HunkAccessibleDiffViewer>());
|
||||
|
||||
|
||||
constructor(
|
||||
location: IChatWidgetLocationOptions,
|
||||
private readonly _parentEditor: ICodeEditor,
|
||||
@@ -583,12 +585,13 @@ export class EditorBasedInlineChatWidget extends InlineChatWidget {
|
||||
@ITextModelService textModelResolverService: ITextModelService,
|
||||
@IChatService chatService: IChatService,
|
||||
@IHoverService hoverService: IHoverService,
|
||||
@ILayoutService layoutService: ILayoutService
|
||||
) {
|
||||
super(location, {
|
||||
...options,
|
||||
chatWidgetViewOptions: {
|
||||
...options.chatWidgetViewOptions,
|
||||
// editorOverflowWidgetsDomNode: _parentEditor.getOverflowWidgetsDomNode() ?? _parentEditor.getDomNode() ?? undefined
|
||||
editorOverflowWidgetsDomNode: layoutService.mainContainer.appendChild($('.inline-chat-overflow.monaco-editor'))
|
||||
}
|
||||
}, instantiationService, contextKeyService, keybindingService, accessibilityService, configurationService, accessibleViewService, textModelResolverService, chatService, hoverService);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user