I'm trying to create a "dynamic" Live Template and I'm beginning to think what I'm trying to accomplish may not be possible. I'm not tied to Groovy Script, but it looks to be the most promising alternative to what I'm trying to accomplish. Here's what I'm trying to accomplish:
- Whatever is typed after hitting <kbd>TAB</kbd> and before hitting <kbd>Enter</kbd> is passed to the template, formatted and written back to the Editor. My goal is to have the resulting string be a specified length, but that's less important for the time being. It's really more about how to get keyboard input to the template and back out again.
For example (blk is the abbreviation):
"blk" <kbd>TAB</kbd> "Hello world" <kbd>Enter</kbd> becomes
# ==================== Hello world ====================
with the resulting string always being 80 characters long. In other words, reformat the typed input *before* writing it out to the editor.
Thanks in advance.
EDIT: This question is specific to PyCharm and Python.
[Cross posted per suggestion in other thread.]