This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163685 - [67cat] [gui] Syntax Highlighting Inconsistent
Summary: [67cat] [gui] Syntax Highlighting Inconsistent
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-26 07:09 UTC by esmithbss
Modified: 2011-01-28 20:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot with inconsistent syntax highlighting. (135.90 KB, image/png)
2009-04-26 07:10 UTC, esmithbss
Details
Screenshot. See lines 22-24 and lines 32 in the screenshot. (143.06 KB, image/png)
2009-07-04 04:52 UTC, esmithbss
Details
I've seen simmilar issues in c++, here a small example (317.40 KB, text/plain)
2009-07-10 07:34 UTC, joris_m
Details

Note You need to log in before you can comment on or make changes to this bug.
Description esmithbss 2009-04-26 07:09:37 UTC
[ BUILD # : 200904231401 ]
[ JDK VERSION : 1.6.* ]

The syntax highlighter is inconsistently highlighting the text.  I
have attached a screenshot of one page with 4 instances highlighted. 
The IDE was left for 3+ minutes to allow the syntax highlighter to
adjust prior to capturing the image.
Comment 1 esmithbss 2009-04-26 07:10:42 UTC
Created attachment 80940 [details]
Screenshot with inconsistent syntax highlighting.
Comment 2 Erno Mononen 2009-04-27 15:27:18 UTC
Likely a problem in jruby-parser, I'll take a look at this. I assume you don't use Ruby 1.9?
Comment 3 esmithbss 2009-04-27 17:01:15 UTC
currently using 1.87(MRI) and 1.20(JRuby) only.
Comment 4 Erno Mononen 2009-06-22 16:02:01 UTC
Do you still see this? There some fixes in jruby-parser wrt. somewhat similar cases. I tried with something similar as 
in the screenshot, and seemed to work for me, but it may depend on the whole context. Any chance you could paste a 
minimal code snippet here where you can see the problem? Thanks.
Comment 5 Erno Mononen 2009-07-03 19:44:34 UTC
Marking as incomplete for now, I'd need more info on this - please see my previous comment.
Comment 6 esmithbss 2009-07-03 19:51:48 UTC
Looks like the changes to the parser may have fixed it.

Marking as fixed.
Comment 7 esmithbss 2009-07-04 04:50:50 UTC
Wouldn't you know it.  Just after I can't reproduce it and I close the issue, it pops up again in 6.7 final.

It appears that it's tied somehow to timing.  I typed the contents on line 32 and they were originally mixed brown and
green, then black.  After saving the file, bouncing to another application and back, and waiting about 2 minutes, the
first half changed to green where it had been brown and green intermixed.

Interesting thing.  I cut the line out, saved the file, and pasted the line back in.  When I pasted the line back in, it
originally gets pasted in properly highlighted, but within 1-2 seconds, it reverts to the colors in the screenshot.

Also, notice the underlining on the parameters to the method in lines 22-24.  They are incorrectly highlighting 2
parameters (only selected_date should be marked as unused) and have the positioning incorrect.
Comment 8 esmithbss 2009-07-04 04:52:31 UTC
Created attachment 84354 [details]
Screenshot.  See lines 22-24 and lines 32 in the screenshot.
Comment 9 esmithbss 2009-07-04 04:58:34 UTC
As you can see from the screenshot, the function is not finished.

If I finish the function (in this case, just add the 3 "end"s that finish the code, the syntax highlighting corrects
itself.  Both in the highlighting of what parameters are in use, and in the coloring of all the lines.

Then, if I remove the block endings, the syntax highlighting is still correct.

This implies to me that the issue is the highlighter trying to complete the content in full context and not in the
context of a single line of code.  And when it cannot complete the blocks, it somehow gets confused and gives up.
Comment 10 joris_m 2009-07-10 07:34:18 UTC
Created attachment 84573 [details]
I've seen simmilar issues in c++, here a small example
Comment 11 Erno Mononen 2010-04-28 13:45:46 UTC
Are you still seeing this? Can you recall whether this was with Ruby 1.8 or 1.9 (the 1.9 parser has some issues with getting correct source positions, which could be related - although this may also be an issue in the core editor). Unfortunately without a reproducible case this will be very hard to track down..
Comment 12 esmithbss 2010-04-28 19:26:51 UTC
This was with the 1.8.7 version of Ruby and 1.4 version of JRuby.

I think this is a combination of performance and highlighting.  The reason I can see it is that I have the tendency to run a very busy machine so I can "see" things happening in the IDE.  Second is that the highlighting has had some problems.

Is it possible that the highlighter thread "times-out" when running on slow machines?
Comment 13 Erno Mononen 2010-04-29 11:12:10 UTC
I see, thanks for the details. I think the highlighter thread shouldn't time out, but I'm not really familiar with that part of the editor infrastructure. Will need to investigate more, but likely not for 6.9 (unless this is too annoying).