Skip to content

Commit f8a8ed9

Browse files
remove jupiter command and selection hack
1 parent cdb3dd9 commit f8a8ed9

File tree

6 files changed

+8
-70
lines changed

6 files changed

+8
-70
lines changed

packages/common/src/types/TextEditor.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,8 @@ export interface EditableTextEditor extends TextEditor {
110110

111111
/**
112112
* Edit a new new notebook cell above.
113-
* @return A promise that resolves to a function that must be applied to any
114-
* selections that should be updated as result of this operation. This is a
115-
* horrible hack to work around the fact that in vscode the promise resolves
116-
* before the edits have actually been performed.
117113
*/
118-
editNewNotebookCellAbove(): Promise<(selection: Selection) => Selection>;
114+
editNewNotebookCellAbove(): Promise<void>;
119115

120116
/**
121117
* Edit a new new notebook cell below.

packages/cursorless-engine/src/actions/EditNew/runNotebookCellTargets.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Selection } from "@cursorless/common";
21
import { ide } from "../../singletons/ide.singleton";
32
import type { Destination } from "../../typings/target.types";
43
import { createThatMark, ensureSingleTarget } from "../../util/targetUtils";
@@ -23,18 +22,13 @@ export async function runEditNewNotebookCellTargets(
2322

2423
await actions.setSelection.run([destination.target]);
2524

26-
let modifyThatMark = (selection: Selection) => selection;
2725
if (isAbove) {
28-
modifyThatMark = await editor.editNewNotebookCellAbove();
26+
await editor.editNewNotebookCellAbove();
2927
} else {
3028
await editor.editNewNotebookCellBelow();
3129
}
3230

3331
const thatMark = createThatMark([destination.target.thatTarget]);
3432

35-
// Apply horrible hack to work around the fact that in vscode the promise
36-
// resolves before the edits have actually been performed.
37-
thatMark[0].selection = modifyThatMark(thatMark[0].selection);
38-
3933
return { thatSelections: thatMark };
4034
}

packages/cursorless-everywhere-talon-core/src/ide/TalonJsEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class TalonJsEditor implements EditableTextEditor {
149149
throw new Error("extractVariable not implemented.");
150150
}
151151

152-
editNewNotebookCellAbove(): Promise<(_selection: Selection) => Selection> {
152+
editNewNotebookCellAbove(): Promise<void> {
153153
throw new Error("editNewNotebookCellAbove not implemented.");
154154
}
155155

packages/cursorless-vscode/src/ide/vscode/VscodeNotebooks.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

packages/cursorless-vscode/src/ide/vscode/VscodeTextEditorImpl.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ import vscodeFocusEditor from "./VscodeFocusEditor";
2424
import { vscodeFold, vscodeUnfold } from "./VscodeFold";
2525
import type { VscodeIDE } from "./VscodeIDE";
2626
import { vscodeInsertSnippet } from "./VscodeInsertSnippets";
27-
import {
28-
vscodeEditNewNotebookCellAbove,
29-
vscodeEditNewNotebookCellBelow,
30-
} from "./VscodeNotebooks";
3127
import vscodeOpenLink from "./VscodeOpenLink";
3228
import { vscodeRevealLine } from "./VscodeRevealLine";
3329
import { VscodeTextDocumentImpl } from "./VscodeTextDocumentImpl";
@@ -137,14 +133,12 @@ export class VscodeTextEditorImpl implements EditableTextEditor {
137133
return vscodeFocusEditor(this);
138134
}
139135

140-
public editNewNotebookCellAbove(): Promise<
141-
(selection: Selection) => Selection
142-
> {
143-
return vscodeEditNewNotebookCellAbove(this);
136+
public async editNewNotebookCellAbove(): Promise<void> {
137+
await vscode.commands.executeCommand("notebook.cell.insertCodeCellAbove");
144138
}
145139

146-
public editNewNotebookCellBelow(): Promise<void> {
147-
return vscodeEditNewNotebookCellBelow(this);
140+
public async editNewNotebookCellBelow(): Promise<void> {
141+
await vscode.commands.executeCommand("notebook.cell.insertCodeCellBelow");
148142
}
149143

150144
public openLink(

packages/neovim-common/src/ide/neovim/NeovimTextEditorImpl.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ export class NeovimTextEditorImpl implements EditableTextEditor {
107107
// throw Error("focus Not implemented");
108108
}
109109

110-
public editNewNotebookCellAbove(): Promise<
111-
(selection: Selection) => Selection
112-
> {
110+
public editNewNotebookCellAbove(): Promise<void> {
113111
throw Error("editNewNotebookCellAbove Not implemented");
114112
}
115113

0 commit comments

Comments
 (0)