File tree Expand file tree Collapse file tree 6 files changed +8
-70
lines changed
cursorless-engine/src/actions/EditNew
cursorless-everywhere-talon-core/src/ide
cursorless-vscode/src/ide/vscode
neovim-common/src/ide/neovim Expand file tree Collapse file tree 6 files changed +8
-70
lines changed Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change 1- import type { Selection } from "@cursorless/common" ;
21import { ide } from "../../singletons/ide.singleton" ;
32import type { Destination } from "../../typings/target.types" ;
43import { 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}
Original file line number Diff line number Diff 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
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ import vscodeFocusEditor from "./VscodeFocusEditor";
2424import { vscodeFold , vscodeUnfold } from "./VscodeFold" ;
2525import type { VscodeIDE } from "./VscodeIDE" ;
2626import { vscodeInsertSnippet } from "./VscodeInsertSnippets" ;
27- import {
28- vscodeEditNewNotebookCellAbove ,
29- vscodeEditNewNotebookCellBelow ,
30- } from "./VscodeNotebooks" ;
3127import vscodeOpenLink from "./VscodeOpenLink" ;
3228import { vscodeRevealLine } from "./VscodeRevealLine" ;
3329import { 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 (
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments