highlighting issue when using mirrors as a default value
Benjarmil opened this issue · 5 comments
Given this snippet :
snippet log
console.log(${1:'data'}, ${2:$1})
You are able to expand and replace 'data'
. and as expected the changes are mirrored into the default value of the second tabstop. hitting tab again will highlight the next tabstop as expected. The problem is that the character count highlighted will always be the same as the original default value no matter how large or small the new value is ( in this case, 'data'
, 6 characters will be highlighted. )
I believe this to be the same as issue #182
As far as I can tell, this is only a problem with version 0 of the snippet parser. I consider this legacy code. Given that I added version 1 over two years ago and that the version 0 code is very hard to work with, I'm not inclined to fix this. Please convert your snippets to version 1 and start using that.
If I'm wrong that this issue only pertains to the version 0 parser, please reopen this. Thank you.
@ajzafar: That's fair that you want to stick with the latest version of the parser. Don't blame you there! I see you have mention of the parser version in the changelog, but I believe I can speak for both of us when stating that neither of us had any idea that there was a different parser available. Furthermore, as you can see from the snippet file on the left in the GIF...there's no snippet version specified, at least that I can see. Wouldn't this apply the version 1 parser, then? Or is version 0 simply used by default?
Whatever the resolution actually is, the fact that this confused us might indicate that the FAQs, or probably even the main README, should be updated. Discovering what you're talking about isn't exactly easy. Would you be open to a PR implementing this, after we test the fix you propose?
Another question that might obviated the long-winded previous comment of mine: why the new engine NOT the default?
@ErichDonGubler The documentation has mentioned the different parser versions since I implemented version 1. Reading through it again now though, I can see there's a lot of room for improvement. So I just improved it and added a FAQ entry to the README in a9802f2.
Version 0 is still the default because many users will require changes to at least some of their snippets. For most these changes will be minor, but the honza/vim-snippets repo in particular will take some time to switch over. However it's been quite a while now, so maybe after I cut a new release the default will change.
In any case, if you have any further suggestions for improving the docs (and really, I do welcome them!), please open a new issue. Thank you!
Just wanted to report this as fixed for me. Thanks for the responses!