vscode-crystal-lang
vscode-crystal-lang copied to clipboard
Heredoc syntax highlighting is incorrect
- Everything after the heredoc start delimiter is not highlighted. Those characters are never part of the heredoc, so they should receive regular highlighting.
- If there are multiple heredocs created on the same line, only the first end delimiter is highlighted and subsequent heredocs are highlighted as if they are regular code.
For comparison, here is how the same code looks like in Ruby:
(It appears they use only the last heredoc name as the delimiter for all heredocs that immediately follow.)
This happens with GitHub itself too, so it should not be used as a guide of correctness:
# crystal
foo(<<-EOS, 1)
abcde
EOS
foo(<<-EOS, <<-MSG)
1
EOS
2
MSG
# ruby
foo(<<-EOS, 1)
abcde
EOS
foo(<<-EOS, <<-MSG)
1
EOS
2
MSG
Related: crystal-lang-tools/language-crystal#29
I don't think this is possible to fix without tree-sitter or an LSP, due to the complexity of Heredocs.