Heredoc looks obvious in ruby highlighting
Reported by frzjubgjvzjjvz | January 15th, 2011 @ 02:46 PM
It seems that the ruby syntax highlighting doesn't know heredocs, look at my screenshot.
Comments and changes to this ticket
-
frzjubgjvzjjvz January 16th, 2011 @ 09:33 AM
same as with the block comment thing. redcar was somewhat confused and after a restart it's like it should be..
-
Michal Hantl January 19th, 2011 @ 06:58 AM
I can confirm this.
<<SOMETHING
<<-SOMETHING
-
tim.felgentreff (at student.hpi.uni-potsdam) January 19th, 2011 @ 03:57 PM
- State changed from new to invalid
-
Michal Hantl January 21st, 2011 @ 06:52 AM
Whats invalid about this issue?
<<HEREDOC
should be treated the same as<<-HEREDOC
and is not. -
tim.felgentreff (at student.hpi.uni-potsdam) January 21st, 2011 @ 08:34 AM
It is not treated the same because Textmate doesn't treat it the same. This is not a bug in Redcar or how Redcar uses the Textmate bundle for highlighting, and I would argue it is not a bug at all. Use "<<-HEREDOC" if you want syntax highlighting, "<<HEREDOC" if you don't, that is the intended behaviour.
-
Michal Hantl January 21st, 2011 @ 08:46 AM
Not really. When you type
<<HEREDOC
, the content still gets highligted in some way.<<
gets higlighted as<<
operator that is used to add strings likemessage << " worl"
HEREDOC
gets higlighted as aCONSTANT
If you think about this, this is clearly a bug, because
<<HEREDOC
is beginning of the Heredoc, not an operator followed by a constant.Textmate obviously has a bug there and so does Redcar.
-
Michal Hantl January 21st, 2011 @ 08:46 AM
Not really. When you type
<<HEREDOC
, the content still gets highligted in some way.<<
gets higlighted as<<
operator that is used to add strings likemessage << " world"
andHEREDOC
gets higlighted as aCONSTANT
If you think about this, this is clearly a bug, because
<<HEREDOC
is beginning of the Heredoc, not an operator followed by a constant.Textmate obviously has a bug there and so does Redcar.
-
Daniel Lucraft January 21st, 2011 @ 09:21 AM
Tim's right this is Textmate behaviour, but not for the reason given. I believe this is because given this code:
foo <<PI
it's impossible to tell whether PI is the start of a heredoc or a constant value.
At least without fully parsing the Ruby file, which is outside the scope of the syntax highlighter in it's current form.
-
Michal Hantl January 21st, 2011 @ 09:53 AM
Maybe there is a way using the current parser.
How does
<<-HEREDOC
work? It could have been intepreted as a<<
minus constant.Maybe we could make a rule that says <<A||<<B||<
I'll look into it and report back.
-
Michal Hantl January 21st, 2011 @ 09:54 AM
Maybe there is a way using the current parser.
How does
<<-HEREDOC
work? It could have been intepreted as a<<
minus constant.Maybe we could make a rule that says
<<A||<<B||<<C ... <<||Z
results in heredoc or that<<
operator needs to be<<[ a-z...]
.I'll look into it and report back.
-
Daniel Lucraft January 21st, 2011 @ 10:09 AM
Ruby itself interprets both of these as a constant:
foo <<-FOO
&
foo <<FOO
So I'm now confused as to how the original code even worked...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A programmer's text editor for Gnome.