Open kmarius opened 2 months ago
Hi, thanks for pinging me :)
This sounds very reasonable, and we already have a small facade around jsregexp, so the __call
-addition will slot right in :D
Right now we suport both jsregexp 0.0.6 or 0.0.5, are there bugfixes/features relevant to luasnip in newer versions (ie. would we even have to upgrade away beyond 0.0.6)?
Hi, thanks for pinging me :) This sounds very reasonable, and we already have a small facade around jsregexp, so the
__call
-addition will slot right in :D Right now we suport both jsregexp 0.0.6 or 0.0.5, are there bugfixes/features relevant to luasnip in newer versions (ie. would we even have to upgrade away beyond 0.0.6)?
There are occasional fixes for libregexp and updates to unicode: Changelog The problem with requiring old versions will always (?) be nixpkgs, i.e. https://github.com/L3MON4D3/LuaSnip/issues/1139
Ah, good points :+1:
Updating once every few months isn't an issue, so definitely feel free to drop the __call
-metamethod, I'll add your fix when we update jsregexp, or sooner if there's some reason :D
Pinging @L3MON4D3
I would like to remove the old, undocumented
__call
metamethod at some point in the future because it duplicates a lot of the matching logic.As far as I can tell, LuaSnip only uses the
begin_ind
property and the capture groups of a match. A simple migration step could look like this: when loading jsregexp, check if the__call
metamethod exists, and if not set to something like this:This should work as long as only the first match is needed and the global flag is not set. A full replacement looks more like this (Note that the match object already contains the full match in
match[0]
which could be used directly by LuaSnip):Opinions? I am not planning to release anything until I have the OK, and there is no urgency whatsoever.