-
-
Notifications
You must be signed in to change notification settings - Fork 84
Add support for 'all' modifier for items within a collection #597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c07b8ad
e1320fa
e1c103b
cece689
7ec8afa
af830f9
8533879
540a994
e94419a
f072856
70e8a52
22b08a8
9b319d9
b19123c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from typing import Any | ||
from talon import Module, app | ||
from talon import Module, Context, app | ||
from ..csv_overrides import init_csv_and_watch_changes | ||
|
||
mod = Module() | ||
|
||
ctx = Context() | ||
|
||
mod.list("cursorless_scope_type", desc="Supported scope types") | ||
|
||
|
@@ -46,17 +46,29 @@ | |
"end tag": "xmlEndTag", | ||
} | ||
|
||
mod.list("select_multiple_modifiers", desc="modifiers for multiple selections") | ||
multiple_modifiers = {"every", "all"} | ||
ctx.lists["user.select_multiple_modifiers"] = multiple_modifiers | ||
|
||
|
||
@mod.capture(rule="[every] {user.cursorless_scope_type}") | ||
@mod.capture(rule="[{user.select_multiple_modifiers}] {user.cursorless_scope_type}") | ||
def cursorless_containing_scope(m) -> dict[str, dict[str, Any]]: | ||
"""Expand to containing scope""" | ||
return { | ||
"modifier": { | ||
"type": "containingScope", | ||
"scopeType": m.cursorless_scope_type, | ||
"includeSiblings": m[0] == "every", | ||
"""Expand to every scope""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely open to putting this into another file, my python is a little weak as is my understanding of how it interacts with Talon. Just lmk. |
||
if m[0] in multiple_modifiers: | ||
return { | ||
"modifier": { | ||
"type": "everyScope", | ||
"scopeType": m.cursorless_scope_type, | ||
"contiguousRange": m[0] == "all" and m[1] == "collectionItem", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we only support this one for |
||
} | ||
} | ||
else: | ||
return { | ||
"modifier": { | ||
"type": "containingScope", | ||
"scopeType": m.cursorless_scope_type, | ||
} | ||
} | ||
} | ||
|
||
|
||
# NOTE: Please do not change these dicts. Use the CSVs for customization. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that these terms should be csv-configurable