Skip to content

Commit 606213c

Browse files
Send to extension
1 parent 552e0e4 commit 606213c

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

cursorless-everywhere-talon/cursorless_everywhere_talon.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ def cursorless_everywhere_edit_text(
6262
):
6363
"""Edit focused element text"""
6464

65+
def cursorless_everywhere_flash_ranges(
66+
ranges: list[FlashDescriptorOffsets], # pyright: ignore [reportGeneralTypeIssues]
67+
):
68+
"""Flash ranges in focused element"""
69+
actions.skip()
70+
71+
# Private actions
72+
6573
def private_cursorless_talonjs_run_and_wait(
6674
command_id: str, # pyright: ignore [reportGeneralTypeIssues]
6775
arg1: Any = None,
@@ -78,10 +86,3 @@ def private_cursorless_talonjs_run_no_wait(
7886

7987
def private_cursorless_talonjs_get_response_json() -> str: # pyright: ignore [reportReturnType]
8088
"""Returns the response from the last Cursorless command"""
81-
82-
def cursorless_everywhere_flash_ranges(
83-
ranges: list[FlashDescriptorOffsets], # pyright: ignore [reportGeneralTypeIssues]
84-
):
85-
"""Flash ranges"""
86-
print("flash ranges", ranges)
87-
actions.skip()

cursorless-everywhere-talon/cursorless_everywhere_talon_browser.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .cursorless_everywhere_types import (
44
EditorEdit,
55
EditorState,
6+
FlashDescriptorOffsets,
67
SelectionOffsets,
78
)
89

@@ -61,6 +62,30 @@ def cursorless_everywhere_edit_text(
6162
if use_fallback(res):
6263
actions.next(edit)
6364

65+
def cursorless_everywhere_flash_ranges(
66+
ranges: list[FlashDescriptorOffsets], # pyright: ignore [reportGeneralTypeIssues]
67+
):
68+
updated = [
69+
js_object_to_python_dict(d, ["style", "range"])
70+
for d in js_array_to_python_list(ranges)
71+
]
72+
updated = [
73+
{
74+
"style": d["style"],
75+
"range": js_object_to_python_dict(d["range"], ["type", "start", "end"]),
76+
}
77+
for d in updated
78+
]
79+
command = {
80+
"id": "flashRanges",
81+
"ranges": updated,
82+
}
83+
rpc(command)
84+
85+
86+
def rpc(command: dict):
87+
actions.user.run_rpc_command(RPC_COMMAND, command)
88+
6489

6590
def rpc_get(command: dict):
6691
return actions.user.run_rpc_command_get(RPC_COMMAND, command)

0 commit comments

Comments
 (0)