talonhub / community

Voice command set for Talon, community-supported.
MIT License
643 stars 783 forks source link

Suggest adding break / continue to Python as statements (like in Java) #1468

Closed CodesAway closed 4 months ago

CodesAway commented 4 months ago

https://github.com/talonhub/community/blob/5a9705869d96a0c55ea63c8dafab44f174d0383c/lang/java/java.py#L224-L228

These two methods are not implemented in Python.py (but I'm suggesting they should be).

2024-06-28 17:17:49.608 ERROR cb error topic="phrase" cb=SpeechSystem.engine_event
   17:             talon\lib\_thread.py:19  * # cron thread
   16:                     threading.py:1002* 
   15:                     threading.py:1045* 
   14:                     threading.py:982 * 
   13:                    talon\cron.py:156 | 
   12:                     talon\vad.py:23  | 
   11:                     talon\vad.py:129 | 
   10: talon\scripting\speech_system.py:394 | 
    9:             talon\engines\w2l.py:731 | 
    8:      talon\scripting\dispatch.py:134 | # 'phrase' main:EngineProxy._redispatch()
    7: talon\scripting\speech_system.py:69  | 
    6: -------------------------------------# [stack splice]
    5:      talon\scripting\dispatch.py:134 | # 'phrase' main:SpeechSystem.engine_event()
    4: talon\scripting\speech_system.py:516 | 
    3:      talon\scripting\executor.py:112 | 
    2:  talon\scripting\talon_script.py:823 | 
    1:  talon\scripting\talon_script.py:725 | 
talon.scripting.talon_script.TalonScriptError: 
 in script at c:\users\cross\appdata\roaming\talon\user\community\lang\tags\imperative.talon:17:
 > user.code_next()
NotImplementedError: Action 'user.code_next' exists but the Module method is empty and no Context reimplements it

I noticed they are part of the keywords, allowing keyword continue

https://github.com/talonhub/community/blob/5a9705869d96a0c55ea63c8dafab44f174d0383c/lang/python/python.py#L62-L64

CodesAway commented 4 months ago

Suggested change will add the following to python.py

    def code_break():
        actions.insert("break")

    def code_next():
        actions.insert("continue")
CodesAway commented 4 months ago

I'll raise a PR to start a discussion.