SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

Auto generated syntax tests shouldn't fill the gaps #398

Open deathaxe opened 1 week ago

deathaxe commented 1 week ago

The command packagedev_generate_syntax_tests_for_line creates a single assertion for meta.tag in following example, while it should create two separate ones for opening and closing tags.

    <p>Our website is in maintenance mode. Please, come back later.</p>
{#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.template.twig #}
{#  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.tag.block.any.html #}
{#  ^ punctuation.definition.tag.begin.html #}
{#   ^ entity.name.tag.block.any.html #}
{#    ^ punctuation.definition.tag.end.html #}
{#                                                                 ^^ punctuation.definition.tag.begin.html #}
{#                                                                   ^ entity.name.tag.block.any.html #}
{#                                                                    ^ punctuation.definition.tag.end.html #}

That always happens if tokens of same scope appear on a line. Created tests expect the whole region between start of first and end of last token to be scoped. Gaps are ignored.