phoenixframework/vscode-phoenix

Syntax highlight in sigil_H only works if it ends exactly in """

Opened this issue · 2 comments

imagem
imagem

I'm not sure if just adding the case for """) is enough or if we need to be more "elixir-aware".

Other scenarios would be having ~H inside arrays, so we could have """, but then it can also be inside a tuple, which depending on the scenario can be formatted with """, anything here}

I think the main problem is that the elixir formatter changes

foo(
  ~H"""
    <div>something</div>
  """
)

into

foo(~H"""
  <div>something</div>
""")

Which makes so that the "correct format" doesn't highlight properly.

Is there anything I can do to help with that?

My current workaround is to either change my formatter so rendered_to_string is no-parens or to assign the result to a variable and then call the rendered_to_string afterwards.

I'm having the same issue. Seems like the regex at https://github.com/phoenixframework/vscode-phoenix/blob/main/syntaxes/elixir-heex.json#L14 is too strict. I don't have any experience with VScode extension and highlights and am wondering if not matching for the line end would work: "end": "^\\s*(\"\"\")",?