renaming the content inside of inlineChat folder from IE to IC

This commit is contained in:
Aiday Marlen Kyzy
2023-06-07 16:02:34 +02:00
parent 30092f40a3
commit c529638000
19 changed files with 390 additions and 390 deletions

View File

@@ -9,8 +9,8 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorAction2 } from 'vs/editor/browser/editorExtensions';
import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { InteractiveEditorController, InteractiveEditorRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST, CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, CTX_INTERACTIVE_EDITOR_EMPTY, CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION, CTX_INTERACTIVE_EDITOR_VISIBLE, MENU_INTERACTIVE_EDITOR_WIDGET, MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK, CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, CTX_INTERACTIVE_EDITOR_EDIT_MODE, EditMode, CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE, MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE, CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED, CTX_INTERACTIVE_EDITOR_DID_EDIT, CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION, MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_SHOWING_DIFF, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { localize } from 'vs/nls';
import { IAction2Options, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -23,7 +23,7 @@ import { IUntitledTextResourceEditorInput } from 'vs/workbench/common/editor';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { Range } from 'vs/editor/common/core/range';
import { fromNow } from 'vs/base/common/date';
import { IInteractiveEditorSessionService, Recording } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { IInlineChatSessionService, Recording } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { runAccessibilityHelpAction } from 'vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp';
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility';
@@ -34,9 +34,9 @@ export class StartSessionAction extends EditorAction2 {
super({
id: 'interactiveEditor.start',
title: { value: localize('run', 'Start Code Chat'), original: 'Start Code Chat' },
category: AbstractInteractiveEditorAction.category,
category: AbstractInlineChatAction.category,
f1: true,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, EditorContextKeys.writable),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable),
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyCode.KeyI,
@@ -45,7 +45,7 @@ export class StartSessionAction extends EditorAction2 {
});
}
private _isInteractivEditorOptions(options: any): options is InteractiveEditorRunOptions {
private _isInteractivEditorOptions(options: any): options is InlineChatRunOptions {
const { initialRange, message, autoSend } = options;
if (
typeof message !== 'undefined' && typeof message !== 'string'
@@ -57,12 +57,12 @@ export class StartSessionAction extends EditorAction2 {
}
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
let options: InteractiveEditorRunOptions | undefined;
let options: InlineChatRunOptions | undefined;
const arg = _args[0];
if (arg && this._isInteractivEditorOptions(arg)) {
options = arg;
}
InteractiveEditorController.get(editor)?.run(options);
InlineChatController.get(editor)?.run(options);
}
}
@@ -71,8 +71,8 @@ export class UnstashSessionAction extends EditorAction2 {
super({
id: 'interactiveEditor.unstash',
title: { value: localize('unstash', 'Resume Last Dismissed Code Chat'), original: 'Resume Last Dismissed Code Chat' },
category: AbstractInteractiveEditorAction.category,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION, EditorContextKeys.writable),
category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_STASHED_SESSION, EditorContextKeys.writable),
keybinding: {
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyCode.KeyZ,
@@ -81,7 +81,7 @@ export class UnstashSessionAction extends EditorAction2 {
}
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
const ctrl = InteractiveEditorController.get(editor);
const ctrl = InlineChatController.get(editor);
if (ctrl) {
const session = ctrl.unstashLastSession();
if (session) {
@@ -94,15 +94,15 @@ export class UnstashSessionAction extends EditorAction2 {
}
}
abstract class AbstractInteractiveEditorAction extends EditorAction2 {
abstract class AbstractInlineChatAction extends EditorAction2 {
static readonly category = { value: localize('cat', 'Interactive Editor'), original: 'Interactive Editor' };
constructor(desc: IAction2Options) {
super({
...desc,
category: AbstractInteractiveEditorAction.category,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, desc.precondition)
category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, desc.precondition)
});
}
@@ -110,7 +110,7 @@ abstract class AbstractInteractiveEditorAction extends EditorAction2 {
if (editor instanceof EmbeddedCodeEditorWidget) {
editor = editor.getParentEditor();
}
const ctrl = InteractiveEditorController.get(editor);
const ctrl = InlineChatController.get(editor);
if (!ctrl) {
for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
@@ -121,53 +121,53 @@ abstract class AbstractInteractiveEditorAction extends EditorAction2 {
}
return;
}
this.runInteractiveEditorCommand(accessor, ctrl, editor, ..._args);
this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
}
abstract runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController, editor: ICodeEditor, ...args: any[]): void;
abstract runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController, editor: ICodeEditor, ...args: any[]): void;
}
export class MakeRequestAction extends AbstractInteractiveEditorAction {
export class MakeRequestAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.accept',
title: localize('accept', 'Make Request'),
icon: Codicon.send,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EMPTY.negate()),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EMPTY.negate()),
keybinding: {
when: CTX_INTERACTIVE_EDITOR_FOCUSED,
when: CTX_INLINE_CHAT_FOCUSED,
weight: KeybindingWeight.EditorCore + 7,
primary: KeyCode.Enter
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET,
id: MENU_INLINE_CHAT_WIDGET,
group: 'main',
order: 1,
when: CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST.isEqualTo(false)
when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.isEqualTo(false)
}
});
}
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.acceptInput();
}
}
export class StopRequestAction extends AbstractInteractiveEditorAction {
export class StopRequestAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.stop',
title: localize('stop', 'Stop Request'),
icon: Codicon.debugStop,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EMPTY.negate(), CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EMPTY.negate(), CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST),
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET,
id: MENU_INLINE_CHAT_WIDGET,
group: 'main',
order: 1,
when: CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST
when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST
},
keybinding: {
weight: KeybindingWeight.EditorContrib,
@@ -176,17 +176,17 @@ export class StopRequestAction extends AbstractInteractiveEditorAction {
});
}
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.cancelCurrentRequest();
}
}
export class ArrowOutUpAction extends AbstractInteractiveEditorAction {
export class ArrowOutUpAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.arrowOutUp',
title: localize('arrowUp', 'Cursor Up'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: {
weight: KeybindingWeight.EditorCore,
primary: KeyCode.UpArrow
@@ -194,17 +194,17 @@ export class ArrowOutUpAction extends AbstractInteractiveEditorAction {
});
}
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.arrowOut(true);
}
}
export class ArrowOutDownAction extends AbstractInteractiveEditorAction {
export class ArrowOutDownAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.arrowOutDown',
title: localize('arrowDown', 'Cursor Down'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: {
weight: KeybindingWeight.EditorCore,
primary: KeyCode.DownArrow
@@ -212,44 +212,44 @@ export class ArrowOutDownAction extends AbstractInteractiveEditorAction {
});
}
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.arrowOut(false);
}
}
export class FocusInteractiveEditor extends EditorAction2 {
export class FocusInlineChat extends EditorAction2 {
constructor() {
super({
id: 'interactiveEditor.focus',
title: { value: localize('focus', 'Focus Input'), original: 'Focus Input' },
f1: true,
category: AbstractInteractiveEditorAction.category,
precondition: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_FOCUSED.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_FOCUSED.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: [{
weight: KeybindingWeight.EditorCore + 10, // win against core_command
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION.isEqualTo('above'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
when: ContextKeyExpr.and(CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('above'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
primary: KeyCode.DownArrow,
}, {
weight: KeybindingWeight.EditorCore + 10, // win against core_command
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION.isEqualTo('below'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
when: ContextKeyExpr.and(CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('below'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
primary: KeyCode.UpArrow,
}]
});
}
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
InteractiveEditorController.get(editor)?.focus();
InlineChatController.get(editor)?.focus();
}
}
export class PreviousFromHistory extends AbstractInteractiveEditorAction {
export class PreviousFromHistory extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.previousFromHistory',
title: localize('previousFromHistory', 'Previous From History'),
precondition: CTX_INTERACTIVE_EDITOR_FOCUSED,
precondition: CTX_INLINE_CHAT_FOCUSED,
keybinding: {
weight: KeybindingWeight.EditorCore + 10, // win against core_command
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
@@ -257,18 +257,18 @@ export class PreviousFromHistory extends AbstractInteractiveEditorAction {
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.populateHistory(true);
}
}
export class NextFromHistory extends AbstractInteractiveEditorAction {
export class NextFromHistory extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.nextFromHistory',
title: localize('nextFromHistory', 'Next From History'),
precondition: CTX_INTERACTIVE_EDITOR_FOCUSED,
precondition: CTX_INLINE_CHAT_FOCUSED,
keybinding: {
weight: KeybindingWeight.EditorCore + 10, // win against core_command
primary: KeyMod.CtrlCmd | KeyCode.DownArrow,
@@ -276,68 +276,68 @@ export class NextFromHistory extends AbstractInteractiveEditorAction {
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.populateHistory(false);
}
}
MenuRegistry.appendMenuItem(MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, {
submenu: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
submenu: MENU_INLINE_CHAT_WIDGET_DISCARD,
title: localize('discardMenu', "Discard..."),
icon: Codicon.discard,
group: '0_main',
order: 2,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview),
when: CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview),
rememberDefaultAction: true
});
export class DiscardAction extends AbstractInteractiveEditorAction {
export class DiscardAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.discard',
title: localize('discard', 'Discard'),
icon: Codicon.discard,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
precondition: CTX_INLINE_CHAT_VISIBLE,
keybinding: {
weight: KeybindingWeight.EditorContrib,
primary: KeyCode.Escape
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main',
order: 0
}
});
}
async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
ctrl.cancelSession();
}
}
export class DiscardToClipboardAction extends AbstractInteractiveEditorAction {
export class DiscardToClipboardAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.discardToClipboard',
title: localize('undo.clipboard', 'Discard to Clipboard'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
// keybinding: {
// weight: KeybindingWeight.EditorContrib + 10,
// primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ,
// mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyZ },
// },
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main',
order: 1
}
});
}
override async runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController): Promise<void> {
override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
const clipboardService = accessor.get(IClipboardService);
const changedText = ctrl.cancelSession();
if (changedText !== undefined) {
@@ -346,22 +346,22 @@ export class DiscardToClipboardAction extends AbstractInteractiveEditorAction {
}
}
export class DiscardUndoToNewFileAction extends AbstractInteractiveEditorAction {
export class DiscardUndoToNewFileAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.discardToFile',
title: localize('undo.newfile', 'Discard to New File'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main',
order: 2
}
});
}
override async runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController, editor: ICodeEditor, ..._args: any[]): Promise<void> {
override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController, editor: ICodeEditor, ..._args: any[]): Promise<void> {
const editorService = accessor.get(IEditorService);
const changedText = ctrl.cancelSession();
if (changedText !== undefined) {
@@ -371,74 +371,74 @@ export class DiscardUndoToNewFileAction extends AbstractInteractiveEditorAction
}
}
export class FeebackHelpfulCommand extends AbstractInteractiveEditorAction {
export class FeebackHelpfulCommand extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.feedbackHelpful',
title: localize('feedback.helpful', 'Helpful'),
icon: Codicon.thumbsup,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
toggled: CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK.isEqualTo('helpful'),
precondition: CTX_INLINE_CHAT_VISIBLE,
toggled: CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('helpful'),
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
group: '2_feedback',
order: 1
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.feedbackLast(true);
}
}
export class FeebackUnhelpfulCommand extends AbstractInteractiveEditorAction {
export class FeebackUnhelpfulCommand extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.feedbackunhelpful',
title: localize('feedback.unhelpful', 'Unhelpful'),
icon: Codicon.thumbsdown,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
toggled: CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK.isEqualTo('unhelpful'),
precondition: CTX_INLINE_CHAT_VISIBLE,
toggled: CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('unhelpful'),
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
group: '2_feedback',
order: 2
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.feedbackLast(false);
}
}
export class ToggleInlineDiff extends AbstractInteractiveEditorAction {
export class ToggleInlineDiff extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.toggleDiff',
title: localize('toggleDiff', 'Toggle Diff'),
icon: Codicon.diff,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT),
toggled: { condition: CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, title: localize('toggleDiff2', "Show Inline Diff") },
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
toggled: { condition: CTX_INLINE_CHAT_SHOWING_DIFF, title: localize('toggleDiff2', "Show Inline Diff") },
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview),
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
when: CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview),
group: '1_config',
order: 9
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.toggleDiff();
}
}
export class ApplyPreviewEdits extends AbstractInteractiveEditorAction {
export class ApplyPreviewEdits extends AbstractInlineChatAction {
constructor() {
super({
@@ -446,51 +446,51 @@ export class ApplyPreviewEdits extends AbstractInteractiveEditorAction {
title: localize('apply1', 'Accept Changes'),
shortTitle: localize('apply2', 'Accept'),
icon: Codicon.check,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, ContextKeyExpr.or(CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED.toNegated(), CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview))),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ContextKeyExpr.or(CTX_INLINE_CHAT_DOCUMENT_CHANGED.toNegated(), CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview))),
keybinding: [{
weight: KeybindingWeight.EditorContrib + 10,
primary: KeyMod.CtrlCmd | KeyCode.Enter,
}],
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_STATUS,
id: MENU_INLINE_CHAT_WIDGET_STATUS,
group: '0_main',
order: 0
}
});
}
override async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): Promise<void> {
override async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
ctrl.acceptSession();
}
}
export class CancelSessionAction extends AbstractInteractiveEditorAction {
export class CancelSessionAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.cancel',
title: localize('cancel', 'Cancel'),
icon: Codicon.clearAll,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EDIT_MODE.isEqualTo(EditMode.Preview)),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EDIT_MODE.isEqualTo(EditMode.Preview)),
keybinding: {
weight: KeybindingWeight.EditorContrib - 1,
primary: KeyCode.Escape
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_STATUS,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.isEqualTo(EditMode.Preview),
id: MENU_INLINE_CHAT_WIDGET_STATUS,
when: CTX_INLINE_CHAT_EDIT_MODE.isEqualTo(EditMode.Preview),
group: '0_main',
order: 1
}
});
}
async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
ctrl.cancelSession();
}
}
export class CopyRecordings extends AbstractInteractiveEditorAction {
export class CopyRecordings extends AbstractInlineChatAction {
constructor() {
super({
@@ -503,11 +503,11 @@ export class CopyRecordings extends AbstractInteractiveEditorAction {
});
}
override async runInteractiveEditorCommand(accessor: ServicesAccessor): Promise<void> {
override async runInlineChatCommand(accessor: ServicesAccessor): Promise<void> {
const clipboardService = accessor.get(IClipboardService);
const quickPickService = accessor.get(IQuickInputService);
const ieSessionService = accessor.get(IInteractiveEditorSessionService);
const ieSessionService = accessor.get(IInlineChatSessionService);
const recordings = ieSessionService.recordings().filter(r => r.exchanges.length > 0);
if (recordings.length === 0) {
@@ -529,62 +529,62 @@ export class CopyRecordings extends AbstractInteractiveEditorAction {
}
}
export class ViewInChatAction extends AbstractInteractiveEditorAction {
export class ViewInChatAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.viewInChat',
title: localize('viewInChat', 'View in Chat'),
icon: Codicon.commentDiscussion,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
precondition: CTX_INLINE_CHAT_VISIBLE,
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'),
id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'),
group: '1_viewInChat',
order: 1
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.viewInChat();
}
}
export class ExpandMessageAction extends AbstractInteractiveEditorAction {
export class ExpandMessageAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.expandMessageAction',
title: localize('expandMessage', 'Expand Message'),
icon: Codicon.chevronDown,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
precondition: CTX_INLINE_CHAT_VISIBLE,
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE.isEqualTo('cropped')),
id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('cropped')),
group: '2_expandOrContract',
order: 1
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.updateExpansionState(true);
}
}
export class ContractMessageAction extends AbstractInteractiveEditorAction {
export class ContractMessageAction extends AbstractInlineChatAction {
constructor() {
super({
id: 'interactiveEditor.contractMessageAction',
title: localize('contractMessage', 'Contract Message'),
icon: Codicon.chevronUp,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE,
precondition: CTX_INLINE_CHAT_VISIBLE,
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE.isEqualTo('expanded')),
id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('expanded')),
group: '2_expandOrContract',
order: 1
}
});
}
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.updateExpansionState(false);
}
}
@@ -594,9 +594,9 @@ export class AccessibilityHelpEditorAction extends EditorAction2 {
super({
id: 'interactiveEditor.accessibilityHelp',
title: localize('actions.interactiveSession.accessibiltyHelpEditor', "Interactive Session Editor Accessibility Help"),
category: AbstractInteractiveEditorAction.category,
category: AbstractInlineChatAction.category,
keybinding: {
when: CTX_INTERACTIVE_EDITOR_FOCUSED,
when: CTX_INLINE_CHAT_FOCUSED,
primary: KeyMod.Alt | KeyCode.F1,
weight: KeybindingWeight.EditorContrib
}