talonvoice / talon

Issue Tracker for the main Talon app
85 stars 0 forks source link

Talon allows some recursive captures #616

Closed pokey closed 1 year ago

pokey commented 1 year ago

test_recursive.py

from talon import Module

mod = Module()

@mod.capture(rule="<user.test_modifier>")
def test_primitive_target(m) -> str:
    """Supported extents for cursorless navigation"""
    return m.test_modifier_list

@mod.capture(rule="down <user.test_primitive_target> up | base")
def test_modifier(m) -> str:
    """Cursorless modifier"""
    return m[0]

test_recursive.talon

test <user.test_primitive_target>: app.notify("hello")

Recursive command example

Talon version

Version: 0.3.1-604-g7a0a, Branch: beta, OS: macOS-13.3.1-arm64-arm-64bit

lunixbochs commented 1 year ago

the recursion check only worked with head recursion (if the recursive rule call was in the leftmost position of a rule), this is fixed in the next beta

2023-09-20 02:52:12.865 WARNING parser recursion: user.test_primitive_target
RuntimeError: Failed to parse: test down down base up up