Skip to content

Commit fc09ed5

Browse files
Updated function
1 parent 92511e1 commit fc09ed5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cursorless-talon/src/snippets.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ def insert_named_snippet(
9393
def insert_custom_snippet(
9494
body: str,
9595
destination: CursorlessDestination,
96-
scope_types: Optional[list[str]] = None,
96+
scope_types: Optional[list[dict]] = None,
9797
):
9898
snippet = {
9999
"type": "custom",
100100
"body": body,
101101
}
102102

103103
if scope_types:
104-
snippet["scopeTypes"] = [{"type": scope_type} for scope_type in scope_types]
104+
snippet["scopeTypes"] = scope_types
105105

106106
insert_snippet(snippet, destination)
107107

@@ -142,7 +142,12 @@ def cursorless_insert_snippet(
142142
if isinstance(scope_type, str):
143143
scope_type = [scope_type]
144144

145-
insert_custom_snippet(body, destination, scope_type)
145+
if scope_type is not None:
146+
scope_types = [{"type": st} for st in scope_type]
147+
else:
148+
scope_types = None
149+
150+
insert_custom_snippet(body, destination, scope_types)
146151

147152
def cursorless_wrap_with_snippet_by_name(
148153
name: str, variable_name: str, target: CursorlessTarget

0 commit comments

Comments
 (0)