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

HEEx heredoc wrapped in function breaks further highlighting #77

Closed
zolrath opened this issue Apr 26, 2024 · 3 comments
Closed

HEEx heredoc wrapped in function breaks further highlighting #77

zolrath opened this issue Apr 26, 2024 · 3 comments

Comments

@zolrath
Copy link

zolrath commented Apr 26, 2024

Hello!
When using a HEEx heredoc within a function the """) section causes further syntax highlighting to break.

  test "breaks syntax highlighting" do
    assigns = %{}
    example = "Hello"

    assert example =~ "Hello"

    component =
      rendered_to_string(~H"""
      <.thing type="test" />
      """)

    assert component =~ "This should be green"
  end

Seems like it works properly on GitHub, here's a screenshot from VS Code!
 image

Thanks for the great work on Lexical!

@Blond11516
Copy link
Collaborator

Blond11516 commented Apr 27, 2024

Hi @zolrath!

Thanks a lot for the report, but I believe this is an issue with the Phoenix Framework extension rather than Lexical. Their grammar for the H sigil enforces that the heredoc delimiters (sequence of 3 double quotes) appears at the very end of the line (with optional sigil arguments). This is what causes """) to not be interpreted as closing the sigil and the rest of the document is thus interperted as being part of the sigil.

Interestingly, this only appears to be the case with heredoc separators. None of the other separators have this requirement.

I've also confirmed that both elixir-ls and elixir-tools share the same issue.

I'd suggest you open an issue/PR over on the vscode-phoenix repo. I think the fix might be as simple as removing the $ from the end of line 14 but I'm not sure if there was a specific reason for having it in the first place.

@zolrath
Copy link
Author

zolrath commented Apr 27, 2024

Oh dang, I thought I had removed all other Elixir/Phoenix extensions before reporting this, sorry about that!
I'll make a PR over there, thanks!

@Blond11516
Copy link
Collaborator

No worries, mistakes happen!

Adding links to the vscode-phoenix issue and corresponding PR for future reference:

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