Skip to content

Commit be00aa9

Browse files
AndreasArvidssonpre-commit-ci-lite[bot]phillco
authored
Added voice command to migrate Cursorless snippet to community format (#2747)
2 fields in the Cursorless snippets are not available in the community format 1. scopeTypes. To my knowledge the only use case is omitting the `function` keyword when in a javascript class 2. excludeDescendantScopeTypes: Used in conjunction with `scopeTypes` to include the function keyword when in a function inside a class. scopeTypes and excludeDescendantScopeTypes I'm not to sure we want to add to community. First of all they have a single use case and needing two separate fields just to describe this behavior fields a bit verbose. As well community doesn't have support for sending multiple snippets. I'm planning this as a follow up. Reference https://github.com/cursorless-dev/cursorless/blob/57acd6c0fcc32e5df122ce09bb26bde5f09495ca/packages/common/src/types/snippet.types.ts#L4-L24 Fixes #2355 ## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Phil Cohen <phillip@phillip.io>
1 parent 333a520 commit be00aa9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/actions/generate_snippet.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616
@mod.action_class
1717
class Actions:
18+
def private_cursorless_migrate_snippets():
19+
"""Migrate snippets from Cursorless to community format"""
20+
actions.user.private_cursorless_run_rpc_command_no_wait(
21+
"cursorless.migrateSnippets",
22+
str(get_directory_path()),
23+
)
24+
1825
def private_cursorless_generate_snippet_action(target: CursorlessExplicitTarget): # pyright: ignore [reportGeneralTypeIssues]
1926
"""Generate a snippet from the given target"""
2027
actions.user.private_cursorless_command_no_wait(

src/cursorless.talon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ tutorial resume: user.private_cursorless_tutorial_resume()
4747
tutorial (list | close): user.private_cursorless_tutorial_list()
4848
tutorial <number_small>:
4949
user.private_cursorless_tutorial_start_by_number(number_small)
50+
51+
{user.cursorless_homophone} migrate snippets:
52+
user.private_cursorless_migrate_snippets()

0 commit comments

Comments
 (0)