-
Requirement: I think LuaSnip can be used in code refactoring. For instance
This is nice but LuaSnip could do it better IMO.
So I'm just wondering if something like this is possible right now or will there be something similar? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh, yeah certainly!! Look for Regarding your suggestion, that's very possible! Regarding refactoring in general, I think the |
Beta Was this translation helpful? Give feedback.
Oh, yeah certainly!! Look for
snip_expand
in DOC.md, you can expand any snippet, you just need to have the snippet-object (created bys(...)
) (there are some other discussions on this, I'm too lazy to look for the exact ones right now, but search should turn them up :) ).One issue with
snip_expand
is that it can't handle eg. snippets withregTrig
/non-plaintexttrigEngine
(we don't know whether the text at the expand-position matches the pattern/regex), or more precisely, it can handle them, but it won't set theenv
-variables.Regarding your suggestion, that's very possible!
You'd have to set
expand_params.env_override.VISUAL
to the text selected in visual mode, and then use it inside the…