mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
chore - remove dead/stale commands (#213207)
This commit is contained in:
@@ -11,16 +11,15 @@ import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/diffEditor/em
|
||||
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
|
||||
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
|
||||
import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
||||
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF, ACTION_REGENERATE_RESPONSE } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
|
||||
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_HAS_STASHED_SESSION, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF, ACTION_REGENERATE_RESPONSE } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
|
||||
import { localize, localize2 } from 'vs/nls';
|
||||
import { Action2, IAction2Options, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { Action2, IAction2Options } from 'vs/platform/actions/common/actions';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IUntitledTextResourceEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { fromNow } from 'vs/base/common/date';
|
||||
import { IInlineChatSessionService, Recording } from './inlineChatSessionService';
|
||||
@@ -250,18 +249,6 @@ export class DiscardHunkAction extends AbstractInlineChatAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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: ContextKeyExpr.and(CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview), CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Live), CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.OnlyMessages)),
|
||||
rememberDefaultAction: true
|
||||
});
|
||||
|
||||
|
||||
export class DiscardAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
@@ -274,11 +261,6 @@ export class DiscardAction extends AbstractInlineChatAction {
|
||||
weight: KeybindingWeight.EditorContrib - 1,
|
||||
primary: KeyCode.Escape,
|
||||
when: CTX_INLINE_CHAT_USER_DID_EDIT.negate()
|
||||
},
|
||||
menu: {
|
||||
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
|
||||
group: '0_main',
|
||||
order: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -288,60 +270,6 @@ export class DiscardAction extends AbstractInlineChatAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class DiscardToClipboardAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'inlineChat.discardToClipboard',
|
||||
title: localize('undo.clipboard', 'Discard to Clipboard'),
|
||||
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_INLINE_CHAT_WIDGET_DISCARD,
|
||||
group: '0_main',
|
||||
order: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
|
||||
const clipboardService = accessor.get(IClipboardService);
|
||||
const changedText = await ctrl.cancelSession();
|
||||
if (changedText !== undefined) {
|
||||
clipboardService.writeText(changedText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class DiscardUndoToNewFileAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'inlineChat.discardToFile',
|
||||
title: localize('undo.newfile', 'Discard to New File'),
|
||||
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
|
||||
menu: {
|
||||
id: MENU_INLINE_CHAT_WIDGET_DISCARD,
|
||||
group: '0_main',
|
||||
order: 2
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController, editor: ICodeEditor, ..._args: any[]): Promise<void> {
|
||||
const editorService = accessor.get(IEditorService);
|
||||
const changedText = await ctrl.cancelSession();
|
||||
if (changedText !== undefined) {
|
||||
const input: IUntitledTextResourceEditorInput = { forceUntitled: true, resource: undefined, contents: changedText, languageId: editor.getModel()?.getLanguageId() };
|
||||
editorService.openEditor(input, SIDE_GROUP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ToggleDiffForChange extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user