Home Download Buy Blog Forum Support

[BUG] Ruby RegEx syntax highlighting

[BUG] Ruby RegEx syntax highlighting

Postby Kyrul on Fri Jun 18, 2010 4:51 pm

If there is only one "word" in front of a RegEx string in Ruby, it will botch up the syntax highlighting if there is an escaped quote in the RegEx.

For example:
Code: Select all
When /^\"([^\"]+)\"$/


Everything after the first escaped quote won't highlight correctly. For some reason, this is fixed if there is a double escaped ending quote, like this:
Code: Select all
When /^\"\\"$/


This case probably doesn't happen often in coding, but it is perfectly valid code. The "When ..." syntax above is often used in the Ruby gem Cucumber. Also, I could see it happening when a RegEx is passed to a function as an argument:
Code: Select all
foo /^\"bar\"$/

Putting the argument in parentheses fixes the highlighting, but the former is still valid syntax.
Attachments
ruby-regex-highlight-quirk.png
ruby-regex-highlight-quirk.png (2.37 KiB) Viewed 1744 times
Kyrul
 
Posts: 3
Joined: Fri Jun 18, 2010 4:43 pm

Re: [BUG] Ruby RegEx syntax highlighting

Postby blaix on Tue Mar 08, 2011 3:51 pm

I'm still seeing this. Particularly annoying in Cucumber steps. I tried to find out how to edit syntax highlighting but did not have any luck... Anyone know if this is possible?
blaix
 
Posts: 1
Joined: Tue Mar 08, 2011 3:49 pm

Re: [BUG] Ruby RegEx syntax highlighting

Postby dannyb on Thu Sep 22, 2011 2:31 am

Still seeing this in the latest Sublime Text 2 (#2111). Any chance of a fix?
dannyb
 
Posts: 1
Joined: Thu Sep 22, 2011 2:30 am

Re: [BUG] Ruby RegEx syntax highlighting

Postby marcus3006 on Tue Oct 18, 2011 6:50 am

same in build 2132... any ideas?
marcus3006
 
Posts: 1
Joined: Tue Oct 18, 2011 6:49 am

Re: [BUG] Ruby RegEx syntax highlighting

Postby geoffroy on Thu Nov 17, 2011 2:51 pm

same in build 2139
hope it will be fixed!
geoffroy
 
Posts: 6
Joined: Sat Nov 05, 2011 9:28 am

Re: [BUG] Ruby RegEx syntax highlighting

Postby plzBetterRubySupport on Sat Mar 03, 2012 1:21 pm

Still present. If you try to check for some tags it will also break the highlighting ( viewtopic.php?f=3&t=5759&p=25175#p25175 ).
I would be really happy if ruby support in sublime would improve :)
plzBetterRubySupport
 
Posts: 11
Joined: Sat Mar 03, 2012 12:20 pm

Re: [BUG] Ruby RegEx syntax highlighting

Postby plzBetterRubySupport on Wed Mar 21, 2012 7:59 am

Edit: Seems to be fixed.
Last edited by plzBetterRubySupport on Wed Oct 31, 2012 5:18 pm, edited 1 time in total.
plzBetterRubySupport
 
Posts: 11
Joined: Sat Mar 03, 2012 12:20 pm

Re: [BUG] Ruby RegEx syntax highlighting

Postby plzBetterRubySupport on Wed May 09, 2012 5:55 pm

Another issue on syntax highlighting is

Code: Select all
s.assert_match /label for=\"test\"/, some_variable


but is does work without the leading session-variable (s in this case).

This works:
Code: Select all
assert_match /label for=\"test\"/, some_variable


The same happens in the post above:

Code: Select all
assert_match /window.location . /, s.response.body


works, while

Code: Select all
s.assert_match /window.location . /, s.response.body


does not.

Edit:
This does also break the following syntax highlighting:
Code: Select all
assert_no_match /foo,/, str


Edit2:
And another:

Multiline comments are not recognized as those if there is a single line comment before.
For example:

Code: Select all
# TODO: fix sublime syntax highlighting
=begin
this text is a comment so it should be handled as those
=end
I would be really happy if ruby support in sublime would improve :)
plzBetterRubySupport
 
Posts: 11
Joined: Sat Mar 03, 2012 12:20 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 19 guests