Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser never leaves comment mode when it encounters an embedded comment #25

Open
davidgumberg opened this issue Sep 22, 2023 · 1 comment

Comments

@davidgumberg
Copy link

As far as I am aware, ERB Syntax permits an embedded ruby comment in a non-comment erb tag

<%   # This line is not an ERB comment, but it does nothing %>

But, once the treesitter encounters a mid-embedding comment, it evaluates and highlights the rest of the embedded ruby as comments.
For example

<%= tag.div class: 'outer-div' do %>
    <%= tag.div class: 'inner-div' do %>
        <p>Text</p>
    <% end # .inner-div %>
<% end # .outer-div %>

<% value = 12 %>
<p> <%= value %> </p>

Even though this works just fine all the rest of the embedded ruby will be evaluated, from the fourth line:

<% end # .inner-div %>

until the end, all embedded ruby is highlighted as a comment.

As you may notice, the github syntax highlighter also exhibits this bug at present.

@tymoyato
Copy link

i tried indeed but this case looks mind blowing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants