File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
cursorless-everywhere-talon Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 11from talon import Context , Module , actions
22
3- from .cursorless_everywhere_types import EditorEdit , EditorState , SelectionOffsets
3+ from .cursorless_everywhere_types import (
4+ EditorChange ,
5+ EditorEdit ,
6+ EditorState ,
7+ SelectionOffsets ,
8+ )
49
510mod = Module ()
611
@@ -43,8 +48,9 @@ def cursorless_everywhere_edit_text(
4348 edit : EditorEdit , # pyright: ignore [reportGeneralTypeIssues]
4449 ):
4550 command = {
46- "id" : "setText " ,
51+ "id" : "editText " ,
4752 "text" : edit ["text" ],
53+ "changes" : get_serializable_editor_changes (edit ["changes" ]),
4854 }
4955 res = rpc_get (command )
5056 if use_fallback (res ):
@@ -71,3 +77,17 @@ def get_serializable_selections(selections: list[SelectionOffsets]):
7177 }
7278 )
7379 return result
80+
81+
82+ def get_serializable_editor_changes (changes : list [EditorChange ]):
83+ result : list [EditorChange ] = []
84+ for i in range (changes .length ): # pyright: ignore [reportAttributeAccessIssue]
85+ change = changes [i ]
86+ result .append (
87+ {
88+ "text" : change ["text" ],
89+ "rangeOffset" : change ["rangeOffset" ],
90+ "rangeLength" : change ["rangeLength" ],
91+ }
92+ )
93+ return result
You can’t perform that action at this time.
0 commit comments