Skip to content

Commit

Permalink
Automatic snippet generator (#310)
Browse files Browse the repository at this point in the history
* Generate snippets

subrepo:
  subdir:   "cursorless-talon"
  merged:   "59c9118b"
upstream:
  origin:   "file:///Users/pokey/src/cursorless-talon-development"
  branch:   "generate-snippet"
  commit:   "59c9118b"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

Old generate snippets

Fixes

* Some cleanup

* Some cleanup

* Stop modifying document

* Fixed tests

* Update doc

* More cleanup

* docs

* More cleanup

* Docs

* Cleanup

* Remove executable bet on actions

Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
  • Loading branch information
pokey and AndreasArvidsson authored Jul 4, 2022
1 parent 5a3a9a7 commit c660c02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from .actions_callback import callback_action_defaults, callback_action_map
from .actions_custom import custom_action_defaults
from .actions_makeshift import makeshift_action_defaults, makeshift_action_map
from .actions_simple import positional_action_defaults, simple_action_defaults
from .actions_simple import (
no_wait_actions,
positional_action_defaults,
simple_action_defaults,
)

mod = Module()

Expand Down Expand Up @@ -48,6 +52,10 @@ def cursorless_command(action_id: str, target: dict):
actions.sleep(f"{talon_options.post_command_sleep_ms}ms")

return return_value
elif action_id in no_wait_actions:
return actions.user.cursorless_single_target_command_no_wait(
action_id, target
)
else:
return actions.user.cursorless_single_target_command(action_id, target)

Expand Down
6 changes: 6 additions & 0 deletions src/actions/actions_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"shuffle": "randomizeTargets",
"reverse": "reverseTargets",
"scout all": "findInWorkspace",
"snippet make": "generateSnippet",
"sort": "sortTargets",
"take": "setSelection",
"unfold": "unfoldRegion",
Expand All @@ -42,6 +43,11 @@
"paste": "pasteFromClipboard",
}

# Don't wait for these actions to finish, usually because they hang on some kind of user interaction
no_wait_actions = [
"generateSnippet",
]

mod = Module()
mod.list(
"cursorless_simple_action",
Expand Down

0 comments on commit c660c02

Please sign in to comment.