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

joh/radical woodpecker #177457

Merged
merged 3 commits into from Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/vs/workbench/api/common/extHostInteractiveEditor.ts
Expand Up @@ -73,15 +73,25 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
}

const document = this._documents.getDocument(URI.revive(uri));
const session = await entry.provider.prepareInteractiveEditorSession({ document, selection: typeConvert.Selection.to(range) }, token);
const selection = typeConvert.Selection.to(range);
const session = await entry.provider.prepareInteractiveEditorSession({ document, selection }, token);
if (!session) {
return undefined;
}

if (session.wholeRange && !session.wholeRange.contains(selection)) {
throw new Error(`InteractiveEditorSessionProvider returned a wholeRange that does not contain the selection.`);
}

const id = ExtHostInteractiveEditor._nextId++;
this._inputSessions.set(id, new SessionWrapper(session));

return { id, placeholder: session.placeholder, slashCommands: session.slashCommands };
return {
id,
placeholder: session.placeholder,
slashCommands: session.slashCommands,
wholeRange: typeConvert.Range.from(session.wholeRange),
};
}

async $provideResponse(handle: number, item: IInteractiveEditorSession, request: IInteractiveEditorRequest, token: CancellationToken): Promise<IInteractiveEditorResponseDto | undefined> {
Expand Down
Expand Up @@ -25,7 +25,6 @@ registerAction2(interactiveEditorActions.ArrowOutDownAction);
registerAction2(interactiveEditorActions.FocusInteractiveEditor);
registerAction2(interactiveEditorActions.PreviousFromHistory);
registerAction2(interactiveEditorActions.NextFromHistory);
registerAction2(interactiveEditorActions.UndoCommand);

// registerAction2(interactiveEditorActions.ToggleHistory);
// registerAction2(interactiveEditorActions.UndoCommand);
registerAction2(interactiveEditorActions.CopyRecordings);
Expand Up @@ -110,34 +110,6 @@
outline: 1px solid var(--vscode-checkbox-border);
}

/* history */

.monaco-editor .interactive-editor .history {
border-top: 1px solid var(--vscode-widget-border);
padding: 0 10px 2px 2px;
display: block;
color: var(--vscode-descriptionForeground);
}

.monaco-editor .interactive-editor .history.hidden {
display: none;
}

.monaco-editor .interactive-editor .history .history-entry {
display: flex;
justify-content: space-between;
padding: 2px
}

.monaco-editor .interactive-editor .history .history-entry.hidden {
display: none;
}

.monaco-editor .interactive-editor .history .history-entry:hover {
background-color: var(--vscode-list-hoverBackground);
color: var(--vscode-list-hoverForeground);
}

/* decoration styles */

.monaco-editor .interactive-editor-lines-deleted-range-inline {
Expand Down
Expand Up @@ -10,7 +10,7 @@ import { EditorAction2 } from 'vs/editor/browser/editorExtensions';
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { InteractiveEditorController, Recording } from 'vs/workbench/contrib/interactiveEditor/browser/interactiveEditorWidget';
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, CTX_INTERACTIVE_EDITOR_HISTORY_VISIBLE, CTX_INTERACTIVE_EDITOR_HISTORY_POSSIBLE } from 'vs/workbench/contrib/interactiveEditor/common/interactiveEditor';
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 } from 'vs/workbench/contrib/interactiveEditor/common/interactiveEditor';
import { localize } from 'vs/nls';
import { IAction2Options } from 'vs/platform/actions/common/actions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
Expand Down Expand Up @@ -269,11 +269,6 @@ export class UndoCommand extends AbstractInteractiveEditorAction {
keybinding: {
weight: KeybindingWeight.EditorContrib + 10,
primary: KeyMod.CtrlCmd | KeyCode.KeyZ,
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET,
group: 'B',
order: 1
}
});
}
Expand All @@ -283,30 +278,6 @@ export class UndoCommand extends AbstractInteractiveEditorAction {
}
}

export class ToggleHistory extends AbstractInteractiveEditorAction {

constructor() {
super({
id: 'interactiveEditor.toggleHistory',
title: localize('toggleHistory', 'Toggle History'),
icon: Codicon.history,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_HISTORY_POSSIBLE),
toggled: {
condition: CTX_INTERACTIVE_EDITOR_HISTORY_VISIBLE,
},
menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET,
group: 'main',
order: 2
}
});
}

override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.toggleHistory();
}
}

export class CopyRecordings extends AbstractInteractiveEditorAction {

constructor() {
Expand Down