Skip to content

Commit cdd31a8

Browse files
committed
Change names per discussion
1 parent b07458b commit cdd31a8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

cursorless-talon/src/snippets.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def private_cursorless_insert_snippet_with_phrase(
8181
},
8282
)
8383

84-
def cursorless_insert_named_snippet(name: str):
84+
def cursorless_insert_snippet_by_name(name: str):
8585
"""Inserts a named snippet"""
8686
actions.user.cursorless_implicit_target_command(
8787
"insertSnippet",
@@ -91,7 +91,7 @@ def cursorless_insert_named_snippet(name: str):
9191
},
9292
)
9393

94-
def cursorless_insert_custom_snippet(body: str):
94+
def cursorless_insert_snippet(body: str):
9595
"""Inserts a custom snippet"""
9696
actions.user.cursorless_implicit_target_command(
9797
"insertSnippet",
@@ -101,7 +101,9 @@ def cursorless_insert_custom_snippet(body: str):
101101
},
102102
)
103103

104-
def cursorless_wrap_with_named_snippet(name: str, variable_name: str, target: dict):
104+
def cursorless_wrap_with_snippet_by_name(
105+
name: str, variable_name: str, target: dict
106+
):
105107
"""Wrap target with a named snippet"""
106108
actions.user.cursorless_single_target_command_with_arg_list(
107109
"wrapWithSnippet",
@@ -115,7 +117,7 @@ def cursorless_wrap_with_named_snippet(name: str, variable_name: str, target: di
115117
],
116118
)
117119

118-
def cursorless_wrap_with_custom_snippet(
120+
def cursorless_wrap_with_snippet(
119121
body: str,
120122
target: dict,
121123
variable_name: Optional[str] = None,

docs/user/customization.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ Cursorless exposes a couple talon actions and captures that you can use to defin
123123

124124
See [snippets](./experimental/snippets.md) for more information about Cursorless snippets.
125125

126-
- `user.cursorless_insert_named_snippet(name: str)`: Insert a snippet with the given name, eg `functionDeclaration`
127-
- `user.cursorless_insert_custom_snippet(body: str)`: Insert a snippet with the given body defined using our snippet body syntax (see the [snippet format docs](./experimental/snippet-format.md)). The body should be a single string, which could contain newline `\n` characters, rather than a list of strings as is expected in our snippet json representation.
128-
- `user.cursorless_wrap_with_named_snippet(name: str, variable_name: str, target: dict)`: Wrap the given target with a snippet with the given name, eg `functionDeclaration`. Note that `variable_name` should be one of the variables defined in the named snippet. Eg, if the named snippet has a variable `$foo`, you can pass in `"foo"` for `variable_name`, and `target` will be inserted into the position of `$foo` in the given named snippet.
129-
- `user.cursorless_wrap_with_custom_snippet(body, target, variable_name, scope)`: Wrap the given target with a snippet with the given body defined using our snippet body syntax (see the [snippet format docs](./experimental/snippet-format.md)). The body should be a single string, which could contain newline `\n` characters, rather than a list of strings as is expected in our snippet json representation. Note that `variable_name` should be one of the variables defined in `body`. Eg, if `body` has a variable `$foo`, you can pass in `"foo"` for `variable_name`, and `target` will be inserted into the position of `$foo` in the given named snippet. The `scope` variable can be used to automatically expand the target to the given scope type, eg `"line"`.
126+
- `user.cursorless_insert_snippet_by_name(name: str)`: Insert a snippet with the given name, eg `functionDeclaration`
127+
- `user.cursorless_insert_snippet(body: str)`: Insert a snippet with the given body defined using our snippet body syntax (see the [snippet format docs](./experimental/snippet-format.md)). The body should be a single string, which could contain newline `\n` characters, rather than a list of strings as is expected in our snippet json representation.
128+
- `user.cursorless_wrap_with_snippet_by_name(name: str, variable_name: str, target: dict)`: Wrap the given target with a snippet with the given name, eg `functionDeclaration`. Note that `variable_name` should be one of the variables defined in the named snippet. Eg, if the named snippet has a variable `$foo`, you can pass in `"foo"` for `variable_name`, and `target` will be inserted into the position of `$foo` in the given named snippet.
129+
- `user.cursorless_wrap_with_snippet(body, target, variable_name, scope)`: Wrap the given target with a snippet with the given body defined using our snippet body syntax (see the [snippet format docs](./experimental/snippet-format.md)). The body should be a single string, which could contain newline `\n` characters, rather than a list of strings as is expected in our snippet json representation. Note that `variable_name` should be one of the variables defined in `body`. Eg, if `body` has a variable `$foo`, you can pass in `"foo"` for `variable_name`, and `target` will be inserted into the position of `$foo` in the given named snippet. The `scope` variable can be used to automatically expand the target to the given scope type, eg `"line"`.
130130

131131
### Example of combining capture and action
132132

0 commit comments

Comments
 (0)