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
Heredoc syntax highlighting is broken for Ruby #710
Comments
Can you post the raw code so I don’t have to re-type it? |
|
Could you please elevate the priority for this Bug? It greatly impacts user experiense. |
RE Original report: It's not immediately apparent from the screenshot, but Sublime is trying to pop the HEREDOCs from the stack LIFO. func(<<-var1, <<-var2, <<-var3)
some text 1
var1
some text 2
var2
some text 3
var3
# still in "var2"
var2
# still in "var1"
var1
# Now we're free
h = {a: 1, c: 2, r: 3} RE second report: plaintext below sql = <<~SQL
#{ITEM_SELECT}
WHERE sku = '#{sku}'
SQL |
With regards to the original error report: Sublime Text's syntax engine can't handle multiple HEREDOCs at a line. I tried to implement it for Perl before, but you just can't do it proberly because HEREDOCs don't push/pop in a linear style. We'd need a new engine feature for it. With regards of the secondreport: This issue is partly fixed by #2054, but might not yet work for all supported embedded syntaxes in any situation. It's tricky (and currently a bit dangerous) to inject the interpolation support into an embedded syntax as the required |
How about |
Not sure, what the intention of those huge screenshots is, but this kind of heredocs is not possible with ST's syntax highlighting engine. |
Heh, sorry about large images - was just curious myself how they all compare so I thought I would document it, maybe someone in future might have an idea of how logic could be borrowed from one of the other engines. |
The logic how to do it has already been out-lined by a former sublimehq dev. It would require a rather specific syntax engine logic and syntax definition syntax for just this single use case. As there are only very few syntaxes left these days making use of heredocs, it seems rather unlikely to be supported anytime soon. |
Gotcha - thanks! |
The regression was introduced by the PR #466
Now all the code in a file is highlighted as a sting after the heredoc formatted method call:
This behavior has seriously impacted the SublimeText usage on the projects where heredoc method calls are used oftenly, so I have to revert the change in the Ruby.sublime-syntax file or stay on the build 3114 where it was working.
On build version 3114 syntax highlighting was working slightly better, but still not fully correct. First text variable was highlighted correctly, but rest of them not. But at least it was not ruining the highlighting for the rest of my code.
p.s.: issue discussion on forum: https://forum.sublimetext.com/t/herodoc-text-format-is-broken/24266/2
The text was updated successfully, but these errors were encountered: