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.
Summary: | Embedded JS code in HTML file creates wrong highlight | ||
---|---|---|---|
Product: | javascript | Reporter: | meanyack |
Component: | Editor | Assignee: | Petr Pisl <ppisl> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | aneyeforanapi, ecerichter, mmirilovic, nb_johan1, po_taka, vriha |
Priority: | P2 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Other | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
cursor is on a variable, but it highlights wrong places.
sample file javax.swing.text.BadLocationException |
Created attachment 132067 [details]
sample file
Reproducible, in the attached sample file, focus "wine" on line 16. However try "addWine", "AppRouter" etc. and it works fine. What seems to caused it is usage of the variable in object literal (line 17 in this case)
*** Bug 227158 has been marked as a duplicate of this bug. *** *** Bug 227451 has been marked as a duplicate of this bug. *** I'm pretty sure this wasn't an issue in previous versions (ie 6.9) I heard that javascript parser changed in the new versions maybe that causes this problem ? New parser is known as Nashor while the old one was Rhino. Link: http://netbeans.org/bugzilla/show_bug.cgi?id=226477#c1 @meanyack: You are right. NetBeans 7.3 has basically new JS Editor that is based on new parser from Nashorn project. IMHO Nashorn is not the causion of this issue. Thanks for the example. I can reproduce it as well. Created attachment 133021 [details]
javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
Comment on attachment 133021 [details]
javax.swing.text.BadLocationException
<record>
<date>2013-03-25T11:34:50</date>
<millis>1364204090614</millis>
<sequence>5332</sequence>
<level>SEVERE</level>
<thread>20</thread>
<message>Invalid offset=1112 > (docLen+1)=883</message>
<exception>
<message>javax.swing.text.BadLocationException: Invalid offset=1112 > (docLen+1)=883</message>
<frame>
<class>org.netbeans.modules.editor.lib2.document.EditorDocumentContent</class>
<method>checkOffsetInContent</method>
<line>280</line>
<file>${netBeansDir}modules/org-netbeans-modules-editor-lib2.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.editor.lib2.document.EditorDocumentContent</class>
<method>createPosition</method>
<line>192</line>
<file>${netBeansDir}modules/org-netbeans-modules-editor-lib2.jar</file>
</frame>
<frame>
<class>org.netbeans.editor.BaseDocument</class>
<method>createPosition</method>
<line>1357</line>
<file>${netBeansDir}modules/org-netbeans-modules-editor-lib.jar</file>
</frame>
<frame>
<class>org.openide.text.NbDocument</class>
<method>createPosition</method>
<line>225</line>
<file>${netbeans.home}modules/org-openide-text.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.editor.InstantRenamePerformer</class>
<method><init></method>
<line>114</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.editor.InstantRenamePerformer</class>
<method>performInstantRename</method>
<line>172</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.api.InstantRenameAction</class>
<method>doInstantRename</method>
<line>250</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.api.InstantRenameAction</class>
<method>access$000</method>
<line>99</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.api.InstantRenameAction$3</class>
<method>run</method>
<line>214</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.editor.BaseDocument</class>
<method>render</method>
<line>1383</line>
<file>${netBeansDir}modules/org-netbeans-modules-editor-lib.jar</file>
</frame>
<frame>
<class>org.netbeans.modules.csl.api.InstantRenameAction</class>
<method>actionPerformed</method>
<line>209</line>
<file>${netBeansDir}modules/org-netbeans-modules-csl-api.jar</file>
</frame>
<frame>
<class>org.netbeans.editor.BaseAction</class>
<method>actionPerformed</method>
<line>339</line>
<file>${netBeansDir}modules/org-netbeans-modules-editor-lib.jar</file>
</frame>
<frame>
<class>javax.swing.SwingUtilities</class>
<method>notifyAction</method>
<line>1664</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>javax.swing.JComponent</class>
<method>processKeyBinding</method>
<line>2879</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>javax.swing.JComponent</class>
<method>processKeyBindings</method>
<line>2926</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>javax.swing.JComponent</class>
<method>processKeyEvent</method>
<line>2842</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Component</class>
<method>processEvent</method>
<line>6282</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Container</class>
<method>processEvent</method>
<line>2229</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Component</class>
<method>dispatchEventImpl</method>
<line>4861</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Container</class>
<method>dispatchEventImpl</method>
<line>2287</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Component</class>
<method>dispatchEvent</method>
<line>4687</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.KeyboardFocusManager</class>
<method>redispatchEvent</method>
<line>1895</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.DefaultKeyboardFocusManager</class>
<method>dispatchKeyEvent</method>
<line>762</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.DefaultKeyboardFocusManager</class>
<method>preDispatchKeyEvent</method>
<line>1027</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.DefaultKeyboardFocusManager</class>
<method>typeAheadAssertions</method>
<line>899</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.DefaultKeyboardFocusManager</class>
<method>dispatchEvent</method>
<line>727</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Component</class>
<method>dispatchEventImpl</method>
<line>4731</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Container</class>
<method>dispatchEventImpl</method>
<line>2287</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Window</class>
<method>dispatchEventImpl</method>
<line>2719</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.Component</class>
<method>dispatchEvent</method>
<line>4687</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue</class>
<method>dispatchEventImpl</method>
<line>729</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue</class>
<method>access$200</method>
<line>103</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue$3</class>
<method>run</method>
<line>688</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue$3</class>
<method>run</method>
<line>686</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.security.AccessController</class>
<method>doPrivileged</method>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.security.ProtectionDomain$1</class>
<method>doIntersectionPrivilege</method>
<line>76</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.security.ProtectionDomain$1</class>
<method>doIntersectionPrivilege</method>
<line>87</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue$4</class>
<method>run</method>
<line>702</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue$4</class>
<method>run</method>
<line>700</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.security.AccessController</class>
<method>doPrivileged</method>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.security.ProtectionDomain$1</class>
<method>doIntersectionPrivilege</method>
<line>76</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventQueue</class>
<method>dispatchEvent</method>
<line>699</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>org.netbeans.core.TimableEventQueue</class>
<method>dispatchEvent</method>
<line>159</line>
<file>${netbeans.home}modules/org-netbeans-core.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>pumpOneEventForFilters</method>
<line>242</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>pumpEventsForFilter</method>
<line>161</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>pumpEventsForHierarchy</method>
<line>150</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>pumpEvents</method>
<line>146</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>pumpEvents</method>
<line>138</line>
<file>${java.home}lib/rt.jar</file>
</frame>
<frame>
<class>java.awt.EventDispatchThread</class>
<method>run</method>
<line>91</line>
<file>${java.home}lib/rt.jar</file>
</frame>
</exception>
</record>
<record>
<date>2013-03-25T11:34:59</date>
<millis>1364204099758</millis>
<sequence>6895</sequence>
<level>CONFIG</level>
<thread>139</thread>
<message>UI_USER_CONFIGURATION</message>
<key>UI_USER_CONFIGURATION</key>
<catalog>org.netbeans.modules.uihandler.Bundle</catalog>
<param>Windows 8, 6.2, amd64</param>
<param>Java HotSpot(TM) 64-Bit Server VM, 23.7-b01, Java(TM) SE Runtime Environment, 1.7.0_13-b20</param>
<param>NetBeans IDE 7.3 (Build 201302132200)</param>
<param></param>
<param>javax.swing.text.BadLocationException: Invalid offset=1112 > (docLen+1)=883</param>
<param></param>
<param>*********</param>
</record>
Is there any progress about this issue? I think variable highlighting is one of the most useful property in NB. Using Alt+Up and Alt+Down saves minutes (and maybe hours). Now I really suffer because most of time I see yellow background color of hundred of lines which disturbs me much. I don't know it helps but if you copy/paste sample file in NB, place cursor on 'wine' keyword and press Ctrl+R (rename keyword), it throws and exception. You can find log here: http://statistics.netbeans.org/analytics/exception.do?id=666771 I'm sorry about the comments above. I was trying to edit/remove attachment I posted. So the highlighting is fixed. The attached example works fine and the cases from duplicates as well. http://hg.netbeans.org/web-main/rev/3eb099eeedbb *** Bug 227740 has been marked as a duplicate of this bug. *** Integrated into 'main-golden', will be available in build *201303252300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/3eb099eeedbb User: Petr Pisl <ppisl@netbeans.org> Log: #226828 - Embedded JS code in HTML file creates wrong highlight Thanks, verified Product Version: NetBeans IDE Dev (Build web-main-10169-on-20130326) Java: 1.7.0_17; Java HotSpot(TM) Client VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b32 System: Linux version 3.2.0-39-generic-pae running on i386; UTF-8; en_US (nb) Backported to release73 as c9968c0023c3 Integrated into 'releases', will be available in build *201305062200* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/c9968c0023c3 User: Petr Pisl <ppisl@netbeans.org> Log: #226828 - transplanting fix Product Version: NetBeans IDE 7.3.1 (Build 201302132200) Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11 System: Linux version 3.2.0-41-generic-pae running on i386; UTF-8; en_US (nb) |
Created attachment 132004 [details] cursor is on a variable, but it highlights wrong places. Create a html file and write some javascript inside it. When you move the cursor, sometimes it highlights irrelevant areas in the document. If you press Ctrl + R, it selects all the texts and changes whole area.