-
-
Notifications
You must be signed in to change notification settings - Fork 91
Deprecate tag user.cursorless_custom_number_small
#2699
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
73454e9
Deprecate tag `user.cursorless_custom_number_small`
AndreasArvidsson 940f865
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] a7c6f6f
Updated deprecated comment
AndreasArvidsson dbdcee2
Merge branch 'deprecateNumberTag' of github.com:cursorless-dev/cursor…
AndreasArvidsson caf92b2
Update cursorless-talon/src/number_small.py
AndreasArvidsson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,20 @@ | ||
""" | ||
This file allows us to use a custom `number_small` capture. See #1021 for more | ||
info. | ||
DEPRECATED @ 2024-12-21 | ||
This file allows us to use a custom `number_small` capture. See #1021 for more info. | ||
""" | ||
|
||
from talon import Context, Module | ||
from talon import Module, app, registry | ||
|
||
mod = Module() | ||
mod.tag( | ||
"cursorless_custom_number_small", | ||
"This tag causes Cursorless to use the global <number_small> capture", | ||
) | ||
|
||
ctx = Context() | ||
ctx.matches = """ | ||
not tag: user.cursorless_custom_number_small | ||
""" | ||
|
||
|
||
@mod.capture(rule="<number_small>") | ||
def private_cursorless_number_small(m) -> int: | ||
return m.number_small | ||
|
||
|
||
digit_list = "zero one two three four five six seven eight nine".split() | ||
teens = "ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen".split() | ||
tens = "twenty thirty forty fifty sixty seventy eighty ninety".split() | ||
mod.tag("cursorless_custom_number_small", "DEPRECATED!") | ||
|
||
number_small_list = [*digit_list, *teens] | ||
for ten in tens: | ||
number_small_list.append(ten) | ||
number_small_list.extend(f"{ten} {digit}" for digit in digit_list[1:]) | ||
number_small_map = {n: i for i, n in enumerate(number_small_list)} | ||
|
||
mod.list("private_cursorless_number_small", desc="List of small numbers") | ||
# FIXME: Remove type ignore once Talon supports list types | ||
# See https://github.com/talonvoice/talon/issues/654 | ||
ctx.lists["self.private_cursorless_number_small"] = number_small_map.keys() # pyright: ignore [reportArgumentType] | ||
def on_ready(): | ||
if "user.cursorless_custom_number_small" in registry.tags: | ||
print( | ||
"WARNING tag: 'user.cursorless_custom_number_small' is deprecated and should not be used anymore" | ||
) | ||
|
||
|
||
@ctx.capture( | ||
"user.private_cursorless_number_small", | ||
rule="{user.private_cursorless_number_small}", | ||
) | ||
def override_private_cursorless_number_small(m) -> int: | ||
return number_small_map[m.private_cursorless_number_small] | ||
app.register("ready", on_ready) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.