dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

snippets.py (1159B)


      1 # defines placeholder actions and captures for ide-specific snippet functionality
      2 from talon import Module, actions, app, Context, imgui, registry
      3 
      4 mod = Module()
      5 mod.tag("snippets", desc="Tag for enabling code snippet-related commands")
      6 mod.list("snippets", desc="List of code snippets")
      7 
      8 
      9 @imgui.open()
     10 def gui(gui: imgui.GUI):
     11     gui.text("snippets")
     12     gui.line()
     13 
     14     if "user.snippets" in registry.lists:
     15         function_list = sorted(registry.lists["user.snippets"][0].keys())
     16         # print(str(registry.lists["user.snippets"]))
     17 
     18         # print(str(registry.lists["user.code_functions"]))
     19         if function_list:
     20             for i, entry in enumerate(function_list):
     21                 gui.text("{}".format(entry, function_list))
     22 
     23 
     24 @mod.action_class
     25 class Actions:
     26     def snippet_search(text: str):
     27         """Triggers the program's snippet search"""
     28 
     29     def snippet_insert(text: str):
     30         """Inserts a snippet"""
     31 
     32     def snippet_create():
     33         """Triggers snippet creation"""
     34 
     35     def snippet_toggle():
     36         """Toggles UI for available snippets"""
     37         if gui.showing:
     38             gui.hide()
     39         else:
     40             gui.show()
     41