Open MoistNubcake opened 2 years ago
That sounds like a useful feature. If you send over a merge request I'll review this optimistically!
Much appreciation for considering this feature. I have to look at the codebase a bit more to create a clean implementation and I will add some documentation (and tests if applicable). I can send you a pull request this weekend I expect.
Proposal I propose a fourth snippet action, 'post_finish', that complements the 'pre_expand' hook. State changes made in the 'pre_expand' action can be reset in a 'post_finish' action. Perhaps there is another already existing way to do this but I could not come up with a reliable one (using the 'post_jump' action and checking for the last jump is not reliable because the user can move out of the snippet without jumping) .
Rationale For some plugins it would be nice to be able to disable them pre-expand and reenable them after the snippet is done. For example 'YouCompleteMe' interferes with the "complete" function implementation in the 'UltiSnips Screencast, Ep4' (https://www.youtube.com/watch?v=JJQYwt6Diro&t=199s) when 'let ycm_auto_trigger' is set to '1'.
Another use would be cleaning up the snippet after the user is done/moves out of the expanded snippet code. I sometimes like to keep extra heads-up notes in snippets that I want to clean up after I'm done altering the expanded snippet text.
Example implementation I made a quick and perhaps dirty working implementation, currently without documentation and unit tests:
https://github.com/MoistNubcake/ultisnips/commit/2539117acdc7ac1950b0c1a52f3a94a516e9485f