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 195855 - Sometimes syntax highlighting is missing in new php web page
Summary: Sometimes syntax highlighting is missing in new php web page
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Lexer (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P1 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords: RANDOM
: 195054 (view as bug list)
Depends on:
Blocks: 195858
  Show dependency tree
 
Reported: 2011-02-23 12:55 UTC by Vladimir Riha
Modified: 2011-03-30 16:32 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
before reopening, with breakpoints (120.02 KB, image/png)
2011-02-23 16:04 UTC, Vladimir Riha
Details
after reopening (119.18 KB, image/png)
2011-02-23 16:04 UTC, Vladimir Riha
Details
message.log file (46.86 KB, application/octet-stream)
2011-02-28 09:17 UTC, Vladimir Riha
Details
log from console (21.19 KB, text/plain)
2011-02-28 09:17 UTC, Vladimir Riha
Details
log from console from nightly build (23.00 KB, text/plain)
2011-03-01 08:20 UTC, Vladimir Riha
Details
log with updated netbeans.conf (20.75 KB, text/plain)
2011-03-01 15:59 UTC, Vladimir Riha
Details
new log (50.65 KB, application/octet-stream)
2011-03-09 08:05 UTC, Vladimir Riha
Details
log with correct netbeans.conf (1.97 MB, application/octet-stream)
2011-03-10 19:34 UTC, Vladimir Riha
Details
Log with embedding creation (66.27 KB, text/plain)
2011-03-24 16:46 UTC, Miloslav Metelka
Details
Log with embedding creation with stacktraces (661.38 KB, text/plain)
2011-03-24 16:47 UTC, Miloslav Metelka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2011-02-23 12:55:56 UTC
Info:
Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)

Sometimes when I create new PHP Web page and it is automatically opened in editor, there is no syntax highlighting, except for gray for comments and black for the rest. Closing and reopening fixes it

The same happens on
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
Comment 1 Petr Pisl 2011-02-23 15:50:31 UTC
Do you think that is similar to the issue #195833?

Could you please attach a screenshot of such situation?

The same questions as in the issue #195833:

When you close and open such file, it helps?
Do the files have the right icons?
Is possible to put a breakpoint to a php code and if yes, it's the breakpoint
correctly colored?

Thanks.
Comment 2 Vladimir Riha 2011-02-23 16:04:11 UTC
Created attachment 106343 [details]
before reopening, with breakpoints
Comment 3 Vladimir Riha 2011-02-23 16:04:49 UTC
Created attachment 106344 [details]
after reopening
Comment 4 Vladimir Riha 2011-02-23 16:07:59 UTC
Screenshots attached (I accidentaly attached them also to issue #195833, but I marked them as obsolete, sorry for that).

I'm not sure, if it's related to #195833.

Answers to your questions:
1. Yes, it will help
2. Yes, icons seems to be fine
3. Yes, I can put breakpoint to php (and html) code and it looks correctly
Comment 5 Petr Pisl 2011-02-24 10:51:54 UTC
I see one big difference between this issue and issue #195833. Here the files are recognized as php files and it seems that everything work, except coloring. Does it work code completion?

Could you please start the IDE from a console (command line) and in Tools->Options->Key map find action Dump View Hierarchy. Assign a shortcut to this action. Then invoke the action through the shortcut over such file? In console there should be output about text hierarchy, could you attach this output?

Also could you attach message.log file (is located in your userdir something like .netbeans/var/log) after opening a php file without coloring?

Thanks
Comment 6 Vladimir Riha 2011-02-25 23:07:29 UTC
I'll get back to the original computer on Monday, today I tried to reproduce it for about a dozen times on the same build but different OS, but it has never occured again. 

Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Windows 7 version 6.1 running on x86; Cp1250; cs_CZ (nb)
Comment 7 Vladimir Riha 2011-02-28 09:17:02 UTC
Created attachment 106527 [details]
message.log file

I have tried it on different JDK, I hope it won't be a problem (the same problem occured anyway). The log is from build 201102230001, but I have tested it also in 201102280001 and the result was the same.

Info
Product Version: NetBeans IDE Dev (Build 201102230001)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 8 Vladimir Riha 2011-02-28 09:17:36 UTC
Created attachment 106528 [details]
log from console

Same info as in message.log file
Comment 9 Petr Pisl 2011-02-28 15:01:26 UTC
The strange thing is that php is colored OK, but the html part is not colored correctly. I'm reassigning this issue into editor and putting on cc Marek, who is responsible for html editor.

Marek have you seen something similar?
Comment 10 Miloslav Metelka 2011-02-28 15:05:04 UTC
I've added lexer info to dump view action could you please use the next nightly build with the change included and do "Dump View Hierarchy" again once this happen and attach the log? Thanks.

http://hg.netbeans.org/jet-main/rev/58d3f896eb59
Comment 11 Vladimir Riha 2011-03-01 08:20:29 UTC
Created attachment 106583 [details]
log from console from nightly build

Here's the log from console, hopefully it's from nightly build (zipped file called ...-nightly-201103010001.zip).

Product Version: NetBeans IDE Dev (Build 201103010001)
Java: 1.7.0-ea; Java HotSpot(TM) Client VM 21.0-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 12 Miloslav Metelka 2011-03-01 15:25:53 UTC
Could you please add the following to netbeans.conf:
-J-Dorg.netbeans.lib.lexer.TokenHierarchyUpdate.level=FINE
-J-Dorg.netbeans.lib.lexer.inc.TokenListUpdater.level=FINE
and reproduce the problem and attach the log? Thanks.
Comment 13 Vladimir Riha 2011-03-01 15:59:30 UTC
Created attachment 106601 [details]
log with updated netbeans.conf

Here is the log generated with updated netbeans.conf
Comment 14 Quality Engineering 2011-03-01 17:55:52 UTC
Integrated into 'main-golden', will be available in build *201103011142* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/58d3f896eb59
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #195855 - Sometimes syntax highlighting is missing in new php web page - added debug of lexer info into Dump View Action.
Comment 15 Miloslav Metelka 2011-03-08 19:14:08 UTC
The dump shows that for some reason there are removed embedded token lists in a joined-token-list-list:

2 TokenListList(s) maintained:
JTLL for "text/x-php5/text/html", hasChildren
[0]: REMOVED-ETLj<0,214> TC=30(30) JI:<0,30>, tli=0, lps=0, IHC=8902659
[1]: REMOVED-ETLj<214,215> TC=1(1) JI:<30,31>, tli=1, lps=0, IHC=7793351
[2]: REMOVED-ETLj<215,261> TC=14(13) JI:<31,44>, tli=2, lps=1, IHC=19906161
[3]: REMOVED-ETLj<307,329> TC=9(9) JI:<44,53>, tli=3, lps=0, IHC=25163143

TLL for "text/x-php5/text/html/text/x-css"

This is an invalid state.
Unfortunately I'm unable to reproduce the problem and find out why this happens.
Could you please add the mentioned switches
  -J-Dorg.netbeans.lib.lexer.TokenHierarchyUpdate.level=FINE
  -J-Dorg.netbeans.lib.lexer.inc.TokenListUpdater.level=FINE
to netbeans.conf and in addition please add also
  -J-Dorg.netbeans.lib.lexer.EmbeddingContainer.level=FINER

Thanks.
Comment 16 Vladimir Riha 2011-03-09 08:05:32 UTC
Created attachment 106843 [details]
new log

Log with the added switches.
Comment 17 Vladimir Riha 2011-03-10 19:34:23 UTC
Created attachment 106889 [details]
log with correct netbeans.conf

Hopefully this one is correct
Comment 18 Jan Becicka 2011-03-18 06:38:44 UTC
*** Bug 195054 has been marked as a duplicate of this bug. ***
Comment 19 Miloslav Metelka 2011-03-22 12:11:53 UTC
All the embeddings are natural (no custom embeddings). I have found one non-document-locked use of token hierarchy in GsfFoldManager which I have fixed.

vriha, could you please test the patch whether it makes any change or not? I'll provide a built module to you. Thanks.

http://hg.netbeans.org/jet-main/rev/cc9616a5f85b
Comment 20 Miloslav Metelka 2011-03-22 12:28:30 UTC
Unfortunately the last patch does not resolve the problem :(
I'll try some additional logging or debug the IDE remotely.
Comment 21 Quality Engineering 2011-03-23 10:00:27 UTC
Integrated into 'main-golden', will be available in build *201103230400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/cc9616a5f85b
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #195855 - Sometimes syntax highlighting is missing in new php web page - added document locking into GsfFoldManager.
Comment 22 Miloslav Metelka 2011-03-24 16:46:38 UTC
Created attachment 107248 [details]
Log with embedding creation
Comment 23 Miloslav Metelka 2011-03-24 16:47:48 UTC
Created attachment 107249 [details]
Log with embedding creation with stacktraces
Comment 24 Miloslav Metelka 2011-03-24 22:59:23 UTC
I've probably found a cause of the problem - in the failing case the code goes through the SyntaxHighlighting layer first which causes creation of the embedding - but in this case the TokenListList is not updated properly although the embedded token list is for joined embedding:

@@@@@@@@@@ NATURAL-EMBEDDING-CREATED EC-IHC=10429893 ROOT-IHC=19422737 for text/x-php5/text/html, language: text/html, LH: org.netbeans.api.html.lexer.HTMLTokenId$1, skip[0, 0];join: ETLj<214,215> TC=0, IHC=6875246, initTokensInNew=true
INFO [org.netbeans.lib.lexer.EmbeddingContainer]: Natural embedding created by:^M
java.lang.Exception^M
org.netbeans.lib.lexer.EmbeddingContainer.embeddedTokenList(EmbeddingContainer.java:198)^M
org.netbeans.api.lexer.TokenSequence.embeddedImpl(TokenSequence.java:358)^M
org.netbeans.api.lexer.TokenSequence.embedded(TokenSequence.java:306)^M
org.netbeans.modules.editor.lib2.highlighting.SyntaxHighlighting$HSImpl.moveNext(SyntaxHighlighting.java:334)^M
org.netbeans.modules.editor.lib2.highlighting.CheckedHighlightsSequence.moveNext(CheckedHighlightsSequence.java:102)^M
org.netbeans.modules.editor.lib2.highlighting.ProxyHighlightsContainer$Sequence2Marks.moveNext(ProxyHighlightsContainer.java:432)^

I'll attempt to fix it in trunk.
Comment 25 Miloslav Metelka 2011-03-26 16:06:15 UTC
Hopefully fixed. The path2tokenListList needs to be cleared before the view hierarchy is made active.

http://hg.netbeans.org/jet-main/rev/bd750f61f5ff
Comment 26 Miloslav Metelka 2011-03-26 16:08:10 UTC
I'd like to ask QE for verification and jlahoda for code review. Thanks.
Comment 27 Vladimir Riha 2011-03-28 07:21:26 UTC
Seems to work fine. I tried to create about 20 documents and without any problem. Verified
Comment 28 Quality Engineering 2011-03-28 08:47:44 UTC
Integrated into 'main-golden', will be available in build *201103280400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/bd750f61f5ff
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #195855 - Sometimes syntax highlighting is missing in new php web page.
Comment 29 Jan Lahoda 2011-03-30 05:00:56 UTC
I do not see any problem in the patch.
Comment 30 Miloslav Metelka 2011-03-30 16:32:56 UTC
In release70:
bd750f61f5ff transplanted to 0d9051d0db99