Snippets in snippets corner case

Plugins for SynWrite and CudaText...
Post Reply
egfips
Posts: 9
Joined: 13.05.2026 03:28

Snippets in snippets corner case

Post by egfips »

I have just more or less finished setting up the snippets I will need from past experience and begin to actually use them. In doing so I bumped into an issue that is an obvious corner case. Not sure how to resolve this, but I expect it may get annoying in the long run. A solution would be nice.

What happens is that after inserting a snippet it is of course text in the editor. If I now tab through the tab stops and happen to enter a word that resolves to a snippet, that snipped will be expanded in place upon pressing the tab key. Not at all what I wanted. I just wanted to tab to the next tab position. This is of course quite counter productive. The obvious reason is that the tab key does double duty here. It triggers snippet expansion and steps through the list of stops in the inserted text.

Possible solutions:
  • suppress snippet expansion while there are still active tab stops
  • use a different key either for snippet expansion or stepping through the tab stops
Neither of these will be a perfect solution either, but the result should be somewhat less annoying than the current behavior. Perhaps some configureability helps but there may also be better ideas how to deal with this.

I might also add, that in my current use case, this is not a situation that happens every once in a blue moon by happenstance. It happens all the time by definition of how that set of snippets works. As there is no way fix this at the moment, I had no choice but to rename the snippets. But frankly the new names don't sit well with me, since I have to remember how I named them. I would rather have names that are obvious.
main Alexey
Posts: 3085
Joined: 25.08.2021 18:15

Re: Snippets in snippets corner case

Post by main Alexey »

fix is easy: we must 'return' from 'on_key' when editor property PROP_TAB_COLLECT_MARKERS is true.
fixed.
plugin is updated in addon-manager.
egfips
Posts: 9
Joined: 13.05.2026 03:28

Re: Snippets in snippets corner case

Post by egfips »

Just tested. Works like a charm. It's of course less than perfect for folks that expect snippets to be expanded while tabbing through the various stops. But I think this is even more of a corner case.
Thanks
Post Reply