You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't something I found very prevalent, so I don't think it's too pressing of an issue, but .sublime-syntax definitions can include insignificant whitespace and comments in regex strings when using the x flag. The only default definition I noticed that heavily uses this is Markdown.sublime-syntax. Manually stripping out the comments dropped the size of serialized_lazy_contexts from 11.0 KiB to 7.9 KiB
I'm not too sure of existing library support, but it may be possible to normalize the regexes when loading them to strip away these decorations. It's worth noting that Markdown.sublime-syntax is by no means the worst size offender (that would be PHP Source's serialized_lazy_contexts at ~30 KiB. Seemingly from its very long lists of keywords that it matches in regexes)
The text was updated successfully, but these errors were encountered:
I've had some more time to dig into this, and I do think that we should be able to automatically strip away comments while doing some of the pre-processing that happens while generating a syntax set. The general gist would be parsing the regex with regex_syntax's Parser::parse_with_comments() and then from there you can manually strip out the comments in the original string based off of the span that's stored with them
I'd be happy to give these changes a shot if they seem worth it
This isn't something I found very prevalent, so I don't think it's too pressing of an issue, but
.sublime-syntax
definitions can include insignificant whitespace and comments in regex strings when using thex
flag. The only default definition I noticed that heavily uses this isMarkdown.sublime-syntax
. Manually stripping out the comments dropped the size ofserialized_lazy_contexts
from 11.0 KiB to 7.9 KiBI'm not too sure of existing library support, but it may be possible to normalize the regexes when loading them to strip away these decorations. It's worth noting that
Markdown.sublime-syntax
is by no means the worst size offender (that would bePHP Source
'sserialized_lazy_contexts
at ~30 KiB. Seemingly from its very long lists of keywords that it matches in regexes)The text was updated successfully, but these errors were encountered: