Bug 227643 - Javascript format and syntax highlighting breaks in JSP if CamelCase JavaScript in script tag
Javascript format and syntax highlighting breaks in JSP if CamelCase JavaScri...
Status: RESOLVED FIXED
Product: web
Classification: Unclassified
Component: HTML Editor
7.3
PC Windows 7
: P2 (vote)
: 8.0
Assigned To: issues@web
issues@javaee
: 7.4_WAIVER_APPROVED, RANDOM, REGRESSION
Depends on: 230125
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-18 23:58 UTC by MackSix
Modified: 2014-02-08 19:34 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Screenshot of alerts. (145.45 KB, image/png)
2013-05-26 04:32 UTC, MackSix
Details
Project to use for reproduction. (HelloWeb7.3) (18.79 KB, application/x-zip-compressed)
2014-01-04 17:35 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-03-18 23:58:02 UTC
1. Open up a project with a JSP page and javascript.
2. If the script tags to not have CamelCase JavaScript in the type attribute, change them to CamelCase like: <script type="text/JavaScript">.
3. Save file and close NetBeans.
4. Restart NetBeans and open the file and the text between <script> tags will be black and formatting will not work on it.
5. Change the type attributes in the script tags to lowercase like: <script type="text/javascript> and nothing will change. Save file with the changes.
6. Close NetBeans and restart it. 
7. Now the text between the script tags is colored and formatting works on it.

Workaround: Always Restart NetBeans for lowercase "javascript" in tags to take effect.

Regression from NetBeans 7.2.1. 

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 MackSix 2013-03-19 00:20:55 UTC
Any invalid type attribute in the script tag will cause an update failure when the the invalid attribute is corrected unless NetBeans is restarted after the correction.
Comment 2 Vladimir Riha 2013-03-19 07:37:35 UTC
It seems a bit random to me. I tried the steps above several times without problem (except of #4 - I reproduced that but lowercasing type attr worked), then once I started over and I reproduced it as well. 

It seems that syntax highlight is "partially" recovered though, for instance name of function in declaration is black bold, I got some JS hints and syntax validation as well. But keywords remain black as well as white background and the mentioned formatter that sets indentation to "0" (one value for all lines). IDE log does not contain any information, except of

INFO [org.netbeans.modules.javascript2.editor.formatter.JsFormatter]: Format visitor: 0 ms
INFO [org.netbeans.modules.javascript2.editor.formatter.JsFormatter]: Formatting changes: 0 ms
INFO [org.netbeans.modules.javascript2.editor.formatter.JsFormatter]: Format token stream creation: 1 ms
INFO [org.netbeans.modules.javascript2.editor.formatter.JsFormatter]: Format visitor: 0 ms
INFO [org.netbeans.modules.javascript2.editor.formatter.JsFormatter]: Formatting changes: 0 ms
...


Although regression wrt 7.2, I think this is more like a P2 and possible patch2 candidate (should the fix be safe).


Product Version: NetBeans IDE 7.3 (Build 201302132200) - patched
Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Linux version 3.2.0-38-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Vladimir Riha 2013-03-19 07:52:20 UTC
These steps reproduces it without the need to restart IDE:
- new user dir, create Java Web project (all default)
- replace content of index.jsp with following:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <script type='text/template' id ='template'>
            <div>
            <%- a %>
            </div>
        </script>
    </body>
</html>



- save file
- select <script>....</script> and replace it with


<script>

function test(){
}

</script>


=> syntax highlighting is partially broken (as described above), formatted doesn't work. Now restart IDE and it is OK and if I again tried these steps, I didn't reproduce it.


I noticed after pasting the first code block and saving file, IDE log contains:

INFO [org.netbeans.modules.editor.lib2.highlighting.DirectMergeContainer]: Disabled an invalid highlighting layer: hlStartOffset=199 < previous hlEndOffset=207 for layer=org.netbeans.modules.html.editor.coloring.EmbeddingHighlightsContainer@106d1e9




Product Version: NetBeans IDE Dev (Build web-main-10115-on-20130319)
Comment 4 Petr Hejl 2013-04-04 12:57:16 UTC
I've debugged the reproducible case. It really only happens with clean dir. However it looks like the JS part is properly lexed and parsed.

It looks like there is problem with mime type change in embedding (maybe even in general).

I'll try to investigate it bit more.

Same thing happens for html file as well.
Comment 5 Vladimir Riha 2013-04-09 08:49:53 UTC
This could be related to issue 227419
Comment 6 Petr Pisl 2013-05-06 12:23:08 UTC
After discussion with Petr H. it's to risky to put this to the patch.
Comment 7 Petr Hejl 2013-05-24 11:10:11 UTC
I would also think this is P3 considering user impact - no duplicates no other reports.
Comment 8 MackSix 2013-05-24 13:15:44 UTC
(In reply to comment #7)
> I would also think this is P3 considering user impact - no duplicates no other
> reports.

Regression is supposed to be p1 according to the priority chart.
Comment 9 MackSix 2013-05-25 13:25:37 UTC
I came across bug [1] while testing this in the latest build. I don't know if it is related or not, but while editing the "type" attribute in a script tag, I experienced it. Once NetBeans completely froze and I had to kill the process.


[1] https://netbeans.org/bugzilla/show_bug.cgi?id=226337


Product Version: NetBeans IDE Dev (Build 201305232300)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 10 MackSix 2013-05-26 04:31:31 UTC
Also, if you type the wrong "type" attribute in the script tag, it will make warnings disappear and they will not come back unless you restart NetBeans.

See the attached screenshot for the warning attributes I am talking about. The tooltip for the warnings say: Missing semicolon ; after ")".
Comment 11 MackSix 2013-05-26 04:32:27 UTC
Created attachment 134900 [details]
Screenshot of alerts.
Comment 12 Marek Fukala 2013-06-19 13:15:21 UTC
Milo, can you please take a look at the tokens hierarchy dump below taken for the document when the problem happens?

It looks like the after the replace of the script tag, the TokenHierarchy becomes somehow invalid (no text/javascript embedding is created on the SCRIPT token since that) as all features working with the TH bound to the live document are not working (the green background, indentation, lexical coloring etc.) while all parser based features works well (semantic coloring, mark occurrences). The semantic features works since the parser result passed to the semantic features is not built on top of the document's TH but on the snapshot's  content.

Since the steps provided by Vlada in comment#3 are followed, the javascript embedding is never created in any new or existing file.

Once the IDE is restarted, the js embeddings works fine, even if you follow the same scenario again.

Thank you in advance for your evaluation.

Here is the dump:

FOLD HIERARCHY DUMP:
component=394496084
[root-fold] E <0,225>, hash=0x3f5f4496, [0, 225] {0, 225}
    [0]: [tags] E0 <16,224>, desc='<.../>', hash=0x538c7a36, [16, 224] {17, 223}
        [0]: [tags] E0 <27,145>, desc='<.../>', hash=0x2bab9a14, [27, 145] {28, 144}
        [1]: [tags] E0 <150,216>, desc='<.../>', hash=0xf10ad72, [150, 216] {151, 215}
            [0]: [tags] E0 <165,204>, desc='<.../>', hash=0x266e216b, [165, 204] {166, 203}
                [0]: [code-block] E0 <190,193>, desc='{...}', hash=0x45bfc9ba, [190, 193] {191, 192}

BLOCKED
BLOCKERS
Fold Managers
FOLD MANAGER [0]:
org.netbeans.modules.csl.editor.fold.GsfFoldManager@5579e89d

TOKEN HIERARCHY DUMP:
TOKEN HIERARCHY for org.netbeans.modules.editor.NbEditorDocument@3876a5a6, mimeType='text/x-jsp', kitClass=null, length=225, version=5, file=org.netbeans.modules.web.core.jsploader.JspDataObject@6764ddfa[/Users/marekfukala/NetBeansProjects/WebApplication5/web/index.jsp@7a9676e3:3463f994]
Text: class org.netbeans.modules.editor.lib2.document.CharContent, length=226:
T[0]: "<!DOCTYPE html>\n<html>\n    <head>\n        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n        <title></title>\n    </head>\n    <body>\n        <script>\n\nfunction test(){\n}\n\n</script>\n    </body>\n</html>\n\n" <0,226> TEXT[0] DefT, la=1, st=org.netbeans.lib.jsp.lexer.JspState@6b7eee95, IHC=1458717767; EC-IHC=996195817
    Embedding[0]: "text/x-jsp/text/html"
    T[ 0]: "<!DOCTYPE" <0,9> DECLARATION[14] DefT, la=1, st=HLS(hc=130626844,s=41), IHC=1908336312
    T[ 1]: " " <9,10> WS[3] DefT, la=1, st=HLS(hc=106489275,s=24), IHC=1103306649
    T[ 2]: "html" <10,14> DECLARATION[14] DefT, la=1, st=HLS(hc=106489275,s=24), IHC=1901041545
    T[ 3]: ">" <14,15> DECLARATION[14] DefT, st=HLS(hc=72412707,s=0), IHC=543546749
    T[ 4]: "\n" <15,16> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=2142259752
    T[ 5]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[ 6]: "html" F(4) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=139816279,s=9,tag=html), IHC=248826262
    T[ 7]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[ 8]: "\n    " <22,27> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=872324725
    T[ 9]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[10]: "head" F(4) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=139564764,s=9,tag=head), IHC=290795006
    T[11]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[12]: "\n        " <33,42> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=1866368917
    T[13]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[14]: "meta" F(4) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=142106961,s=9,tag=meta), IHC=1916239937
    T[15]: " " <47,48> WS[3] DefT, la=1, st=HLS(hc=142106961,s=9,tag=meta), IHC=432367100
    T[16]: "http-equiv" F(10) ARGUMENT[7] FlyT, la=1, st=HLS(hc=-318708203,s=12,tag=meta,attribute=http-equiv), IHC=1856671899
    T[17]: "=" F(1) OPERATOR[8] FlyT, st=HLS(hc=-315868489,s=14,tag=meta,attribute=http-equiv), IHC=48782279
    T[18]: ""Content-Type"" <59,73> VALUE[9] DefT, st=HLS(hc=142106961,s=9,tag=meta), IHC=1892984031
    T[19]: " " <73,74> WS[3] DefT, la=1, st=HLS(hc=142106961,s=9,tag=meta), IHC=2147215583
    T[20]: "content" F(7) ARGUMENT[7] FlyT, la=1, st=HLS(hc=260807901,s=12,tag=meta,attribute=content), IHC=1937099293
    T[21]: "=" F(1) OPERATOR[8] FlyT, st=HLS(hc=263647615,s=14,tag=meta,attribute=content), IHC=48782279
    T[22]: ""text/html; charset=UTF-8"" <82,108> VALUE[9] DefT, st=HLS(hc=142106961,s=9,tag=meta), IHC=412378712
    T[23]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[24]: "\n        " <109,118> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=975728931
    T[25]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[26]: "title" F(5) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=1961505492,s=9,tag=title), IHC=891014825
    T[27]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[28]: "</" F(2) TAG_OPEN_SYMBOL[18] FlyT, st=HLS(hc=78092135,s=4), IHC=882693244
    T[29]: "title" F(5) TAG_CLOSE[6] FlyT, la=1, st=HLS(hc=80931849,s=6), IHC=608318432
    T[30]: ">" <132,133> TAG_CLOSE_SYMBOL[19] DefT, st=HLS(hc=72412707,s=0), IHC=1985726904
    T[31]: "\n    " <133,138> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=68717501
    T[32]: "</" F(2) TAG_OPEN_SYMBOL[18] FlyT, st=HLS(hc=78092135,s=4), IHC=882693244
    T[33]: "head" F(4) TAG_CLOSE[6] FlyT, la=1, st=HLS(hc=80931849,s=6), IHC=1736320868
    T[34]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[35]: "\n    " <145,150> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=189549393
    T[36]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[37]: "body" F(4) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=136691390,s=9,tag=body), IHC=1930802028
    T[38]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[39]: "\n        " <156,165> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=364294779
    T[40]: "<" F(1) TAG_OPEN_SYMBOL[18] FlyT, la=1, st=HLS(hc=83771563,s=8), IHC=1213881049
    T[41]: "script" F(6) TAG_OPEN[5] FlyT, la=1, st=HLS(hc=1834408872,s=9,es=1,tag=script), IHC=226473056
    T[42]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=122112615,s=35,es=1), IHC=292250870
    T[43]: "\n\nfunction test(){\n}\n\n" <173,195> SCRIPT[1] ProT, la=9, st=HLS(hc=72412707,s=0), IHC=991629708
    T[44]: "</" F(2) TAG_OPEN_SYMBOL[18] FlyT, la=7, st=HLS(hc=78092135,s=4), IHC=882693244
    T[45]: "script" F(6) TAG_CLOSE[6] FlyT, la=1, st=HLS(hc=80931849,s=6), IHC=1847401636
    T[46]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[47]: "\n    " <204,209> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=960727926
    T[48]: "</" F(2) TAG_OPEN_SYMBOL[18] FlyT, st=HLS(hc=78092135,s=4), IHC=882693244
    T[49]: "body" F(4) TAG_CLOSE[6] FlyT, la=1, st=HLS(hc=80931849,s=6), IHC=24710489
    T[50]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[51]: "\n" <216,217> TEXT[0] DefT, la=1, st=HLS(hc=72412707,s=0), IHC=844844752
    T[52]: "</" F(2) TAG_OPEN_SYMBOL[18] FlyT, st=HLS(hc=78092135,s=4), IHC=882693244
    T[53]: "html" F(4) TAG_CLOSE[6] FlyT, la=1, st=HLS(hc=80931849,s=6), IHC=143872900
    T[54]: ">" F(1) TAG_CLOSE_SYMBOL[19] FlyT, st=HLS(hc=72412707,s=0), IHC=292250870
    T[55]: "\n\n" <224,226> TEXT[0] DefT, la=1, st=HLS(hc=73832564,s=1), IHC=5243778

1 TokenListList(s) maintained:
JTLL for "text/x-jsp/text/html"
[0]: ETLj<0,226> TC=56(56) JI:<0,56>, tli=0, lps=0, IHC=85347319


DOCUMENT VIEW: 473319724
DV@1c36492c#16 <0,226> incomMod=false, lengthyAE=0
Regions: <NONE>, ChgFlags: <NONE>; visWidth:827, rowHeight=17.0, ascent=13.0, charWidth=8.0
[ 0]: PV@1743f066#2 <0,16> y=0.0, WxH:128.0x17.0, chWxH=128.0x17.0
        [0]: HV@4a2cdb51 <0,15> x=0.0 TL=[15]W=120.0
        [1]: NV@46f2c8e2 <15,16> x=120.0
[ 1]: PV@6d5bc478#2 <16,23> y=17.0, WxH:56.0x17.0, chWxH=56.0x17.0
        [0]: HV@6d6291d1 <16,22> x=0.0 TL=[6]W=48.0
        [1]: NV@62536871 <22,23> x=48.0
[ 2]: PV@23bfda5f#2 <23,34> y=34.0, WxH:88.0x17.0, chWxH=88.0x17.0
        [0]: HV@6193ea28 <23,33> x=0.0 TL=[10]W=80.0
        [1]: NV@35f21a24 <33,34> x=80.0
[ 3]: PV@0899a54f#2 <34,110> y=51.0, WxH:608.0x17.0, chWxH=608.0x17.0
        [0]: HV@3c475519 <34,109> x=0.0 TL=[75]W=600.0
        [1]: NV@6f23fb39 <109,110> x=600.0
[ 4]: PV@1f33e9f2#2 <110,134> y=68.0, WxH:192.0x17.0, chWxH=192.0x17.0
        [0]: HV@23429430 <110,133> x=0.0 TL=[23]W=184.0
        [1]: NV@680eed65 <133,134> x=184.0
[ 5]: PV@09441edf#2 <134,146> y=85.0, WxH:96.0x17.0, chWxH=96.0x17.0
        [0]: HV@2c03b742 <134,145> x=0.0 TL=[11]W=88.0
        [1]: NV@27f464a1 <145,146> x=88.0
[ 6]: PV@5746c739#2 <146,157> y=102.0, WxH:88.0x17.0, chWxH=88.0x17.0
        [0]: HV@1dfa9a85 <146,156> x=0.0 TL=[10]W=80.0
        [1]: NV@2fb6a123 <156,157> x=80.0
[ 7]: PV@67c19bf2#2 <157,174> y=119.0, WxH:136.0x17.0, chWxH=136.0x17.0
        [0]: HV@7f0d194d <157,173> x=0.0 TL=[16]W=128.0
        [1]: NV@34f84f65 <173,174> x=128.0
[ 8]: PV@57e56215#1 <174,175> y=136.0, WxH:8.0x17.0, chWxH=8.0x17.0
        [0]: NV@1a248b0e <174,175> x=0.0
[ 9]: PV@148a7dc8#4 <175,192> y=153.0, WxH:136.0x17.0, chWxH=136.0x17.0
        [0]: HV@050c66b2 <175,184> x=0.0 TL=[9]W=72.0
        [1]: HV@712a32b4 <184,188> x=72.0 TL=[4]W=32.0
        [2]: HV@09670177 <188,191> x=104.0 TL=[3]W=24.0
        [3]: NV@49913073 <191,192> x=128.0
[10]: PV@1047e001#2 <192,194> y=170.0, WxH:16.0x17.0, chWxH=16.0x17.0
        [0]: HV@5b03f3c0 <192,193> x=0.0 TL=[1]W=8.0
        [1]: NV@6077f0ee <193,194> x=8.0
[11]: PV@5ec36a00#1 <194,195> y=187.0, WxH:8.0x17.0, chWxH=8.0x17.0
        [0]: NV@626acabc <194,195> x=0.0
[12]: PV@6f64569a#2 <195,205> y=204.0, WxH:80.0x17.0, chWxH=80.0x17.0
        [0]: HV@51242f1e <195,204> x=0.0 TL=[9]W=72.0
        [1]: NV@1e918430 <204,205> x=72.0
[13]: PV@2471d198#2 <205,217> y=221.0, WxH:96.0x17.0, chWxH=96.0x17.0
        [0]: HV@637d7afd <205,216> x=0.0 TL=[11]W=88.0
        [1]: NV@4315ab12 <216,217> x=88.0
[14]: PV@2c7764d9#2 <217,225> y=238.0, WxH:64.0x17.0, chWxH=64.0x17.0
        [0]: HV@43924d26 <217,224> x=0.0 TL=[7]W=56.0
        [1]: NV@3a071c72 <224,225> x=56.0
[15]: PV@527df95d#1 <225,226> y=255.0, WxH:8.0x17.0, chWxH=8.0x17.0
        [0]: NV@2c119d7c <225,226> x=0.0
caretOffset=204, caretViewIndex=12
caretView: PV@6f64569a#2 <195,205>, WxH:80.0x17.0, chWxH=80.0x17.0
[0]: lineStartOffset=0, info: null
[1]: lineStartOffset=16, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[2]: lineStartOffset=23, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[3]: lineStartOffset=34, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[4]: lineStartOffset=110, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[5]: lineStartOffset=134, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[6]: lineStartOffset=146, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[7]: lineStartOffset=157, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[8]: lineStartOffset=174, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[9]: lineStartOffset=175, info: JspStateInfo state=1, prescan=2, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=2, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[10]: lineStartOffset=192, info: JspStateInfo state=1, prescan=19, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=19, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[11]: lineStartOffset=194, info: JspStateInfo state=1, prescan=21, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=21, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[12]: lineStartOffset=195, info: JspStateInfo state=1, prescan=22, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=22, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[13]: lineStartOffset=205, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[14]: lineStartOffset=217, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=
[15]: lineStartOffset=225, info: JspStateInfo state=1, prescan=1, nestMode=1
  firstTokenID=null, firstTokenLength=-1
  hostStateInfo=state=1, preScan=1, subState=
  jspTagStateInfo=null
  elStateInfo=null
  javaStateInfo=null
  scanning Info=state=-1, preScan=0, subState=

DOCUMENT:
org.netbeans.modules.editor.NbEditorDocument@3876a5a6, mimeType='text/x-jsp', kitClass=null, length=225, version=5, file=org.netbeans.modules.web.core.jsploader.JspDataObject@6764ddfa[/Users/marekfukala/NetBeansProjects/WebApplication5/web/index.jsp@7a9676e3:3463f994], content:
  chars: 377:<204+151,355>, marks: markCount=59, gap:73:<44+14,58>, OGap:<204+536870686,536870890>, bbMarks: BB:markCount=5, gap:6:<3+1,4>, OGap:<205+536871062,536871267>,
GUARDED blocks:
MarkBlockChain: currentBlock=null
block chain:  Empty
Comment 13 Petr Pisl 2013-09-09 07:49:39 UTC
It's now assigned to Mila, but to javascript product. Reassigning to the editor.
Comment 14 Miloslav Metelka 2013-09-15 19:52:31 UTC
Unfortunately I'm unable to reproduce the problem with a recent dev build with the steps in #3. I've tried three times with a fresh userdir. The highlighting appears including bolding of the "test" function however the bolding appears after about 1 second delay.
Since (according to reporters) it looks like a race condition I'm wondering if issue 230125 (I should have a fix within few days) would resolve this problem as well (assuming it still exists).
Reassigning to javascript please reassign back if the problem still appears.
Comment 15 MackSix 2013-09-16 01:11:56 UTC
It does seem to be behaving better without a restart, but if do steps in Comment 0, it still breaks if you open a new file with an invalid type. If you change it to a valid type, shutdown netbeans, restart and the color is there.
Comment 16 Vladimir Riha 2013-09-16 10:29:27 UTC
I tried steps from comment #0 and still reproducible

Product Version: NetBeans IDE 7.4 RC1 (Build 201309152201)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b49
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b107
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 17 Petr Pisl 2013-09-19 09:43:50 UTC
So back to Mila? Still it looks like as situation as is described in comment #12.
Comment 18 Miloslav Metelka 2013-09-24 09:48:30 UTC
Ok, so once I'll integrate issue #230125 we'll re-check whether it helped to resolve this problem or not.
Asking for waiver for 7.4.
Comment 19 Miloslav Metelka 2013-10-11 13:05:47 UTC
(In reply to Vladimir Riha from comment #16)
> I tried steps from comment #0 and still reproducible
> 
> Product Version: NetBeans IDE 7.4 RC1 (Build 201309152201)
> Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b49
> Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b107
> System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)

Vlado, could you please re-test once fix of issue #230125 gets into dev build? Thanks.
Comment 20 Vladimir Riha 2013-10-29 14:07:25 UTC
Still reproducible, after changing type to lower case, some JS coloring is back (bold function name) but most is missing (e.g. background color, keywords...) and formatter does not work. Restart again helps


Product Version: NetBeans IDE Dev (Build 201310290001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 21 Miloslav Metelka 2014-01-02 15:28:10 UTC
Fixed the embedding presence in HTMLTokenId:
http://hg.netbeans.org/jet-main/rev/92db289fc181
Comment 22 Quality Engineering 2014-01-03 02:51:07 UTC
Integrated into 'main-silver', will be available in build *201401030002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/92db289fc181
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #227643 - Javascript format and syntax highlighting breaks in JSP if CamelCase JavaScript in script tag.
Comment 23 MackSix 2014-01-04 17:34:48 UTC
1. Open attached project (HelloWeb7.3).
2. Change type="text/javascript" to type="qwerty".
3. Notice the green highlighting goes away as expected.
4. Place cursor after closing angle bracket after "qwerty".
5. Press Enter.
6. Notice green highlighting appears.

Workaround: Close and reopen document and green highlighting is gone.

7. Change type="text/javascript" and restart NetBeans.
8. Change type="text/plain" and restart NetBeans.
9. Change type="text/javascript" again.

Notice green background returns, but the first letter in myFunction() on line 29 turns to orange.

Also, sometimes going from an invalid type to a valid type may make other miscellanious letters or groups of letters in myFunction() on line 29 turn orange.


Product Version: NetBeans IDE Dev (Build 201401040002)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b63
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b121
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 24 MackSix 2014-01-04 17:35:49 UTC
Created attachment 143598 [details]
Project to use for reproduction. (HelloWeb7.3)
Comment 25 Miloslav Metelka 2014-01-06 15:15:32 UTC
For steps 1.-6. the highlighting appears because scriptType variable at HTMLTokenId:256 becomes null so the mimeType defaults to JAVASCRIPT_MIMETYPE. Not sure why such fallback is present so reassigning to web team.

Fix for 7.-9. problem:
http://hg.netbeans.org/jet-main/rev/62f876088e68
Comment 26 Quality Engineering 2014-01-07 02:50:40 UTC
Integrated into 'main-silver', will be available in build *201401070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/52201ec042ad
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #227643 - Javascript format and syntax highlighting breaks in JSP if CamelCase JavaScript in script tag - removed extra debug.
Comment 27 MackSix 2014-01-07 09:00:44 UTC
I noticed a different behavior in an HTML page as opposed to the JSP page.

1. Copy the same script from response.jsp into the body of index.html.
2. Goto Tools >> Options >> Fonts & Colors >> Syntax >> Language:HTML and set the "Css Embedded in HTML" background color to something different than the "Javascript Embedded in HTML.
3. Change type="text/javascript" to type="text/css".

The page does not reflect the proper color unless you close and reopen the page. 

4. Close and open the page so the color changes.
5. Change back to type="text/javascript" and notice the color does not change. 
6. Remove the closing angle bracket in the opening script tag and retype it.

In this case, the color changes to the correct color.

In response.jsp the color changes by just changing the type.

Product Version: NetBeans IDE Dev (Build 201401070002)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b63
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b121
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 28 Ondrej Brejla 2014-01-15 10:10:37 UTC
Fix for 1.-6. problem in web-main #24a25117bf5b (js mime type is no longer default...really don't know if it breaks something :).

Situation described in comment #27 should be in separate issue (and imho it doesn't wolrk properly in any Nb version).
Comment 29 Quality Engineering 2014-01-16 02:45:01 UTC
Integrated into 'main-silver', will be available in build *201401160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/24a25117bf5b
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #227643 - Javascript format and syntax highlighting breaks in JSP if CamelCase JavaScript in script tag

JavaScript mime type is not returned by default (when null mime type found).
Comment 30 Petr Hejl 2014-01-16 09:57:05 UTC
Unfortunately this change breaks formatting of embedded JS.
Comment 31 Petr Hejl 2014-01-16 09:58:16 UTC
See failing formatting tests here: http://deadlock.netbeans.org/job/javascript2/
Comment 32 Ondrej Brejla 2014-01-16 15:35:32 UTC
Ok, I thought that it will not be so simple ;) I'll revert it...but really don't know what to do with this issue.
Comment 33 MackSix 2014-02-08 19:12:25 UTC
Although it is a separate issue, the issue in comment 27 works now. :)

The steps 1 through 6 in comment 23 is still valid, but certainly not a P2. I think I will resolve this and open a new issue for it.

Product Version: NetBeans IDE Dev (Build 201402060001)
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b69
Runtime: Java(TM) SE Runtime Environment 1.8.0-b128
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo