-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathcursorless_vscode.py
More file actions
40 lines (32 loc) · 1.27 KB
/
cursorless_vscode.py
File metadata and controls
40 lines (32 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from talon import Context, actions, app
from ..actions.get_text import cursorless_get_text_action
from ..targets.target_types import CursorlessTarget
ctx = Context()
ctx.matches = r"""
app: vscode
"""
ctx.tags = ["user.cursorless"]
@ctx.action_class("user")
class Actions:
def private_cursorless_find(target: CursorlessTarget):
"""Find text of target in editor"""
texts = cursorless_get_text_action(target, ensure_single_target=True)
search_text = texts[0]
if len(search_text) > 200:
search_text = search_text[:200]
app.notify("Search text is longer than 200 characters; truncating")
actions.user.private_cursorless_run_rpc_command_no_wait("actions.find")
actions.sleep("50ms")
actions.insert(search_text)
def private_cursorless_show_settings_in_ide():
"""Show Cursorless-specific settings in ide"""
actions.user.private_cursorless_run_rpc_command_no_wait(
"workbench.action.openGlobalSettings"
)
actions.sleep("250ms")
actions.insert("cursorless")
def private_cursorless_show_sidebar():
"""Show Cursorless sidebar"""
actions.user.private_cursorless_run_rpc_command_and_wait(
"workbench.view.extension.cursorless"
)