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 226142 - Javascript Code Folding Error
Summary: Javascript Code Folding Error
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-15 05:23 UTC by wnjordan
Modified: 2013-03-18 19:15 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (35.49 KB, text/plain)
2013-02-15 05:23 UTC, wnjordan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wnjordan 2013-02-15 05:23:37 UTC
Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851)
Operating System = Linux version 3.2.0-37-generic running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

When opening a javascript file all the code contained within curly braces {} is automatically folded.  In the Options, the only box that I have checked for automatic folding is Methods.
Comment 1 wnjordan 2013-02-15 05:23:40 UTC
Created attachment 131407 [details]
IDE log
Comment 2 Vladimir Riha 2013-02-15 07:06:47 UTC
I can't reproduce it, If I have e.g. object literal

var controls = {
    touch: new TouchOperator()
};

then it stays expanded as expected. The same goes for for statements, if-else statements, jsdoc etc. Could you please share code that is incorrectly folded?



Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_15; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b02
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Vladimir Riha 2013-02-15 08:49:52 UTC
I still can't reproduce it but even if I don't think this is P1
Comment 4 wnjordan 2013-02-15 10:07:48 UTC
The code that's reproducing it is every js file on my system.  For some reason everything with curly braces is automatically folded, along with the functions, when the page is opened.  It makes no difference if the braces are on different lines or the same line.  It also does not happen with PHP so it seems to be related only to js.  Is there a log or something like that I can send you that will give you more information about what's happening when the error occurs?
Comment 5 Petr Pisl 2013-02-15 10:23:34 UTC
Did you import any settings from previous version? Could you try it with clean userdir? Just run the ide from command line via command netbeans.sh --userdir /path/to/new/userdir.

Thanks.
Comment 6 wnjordan 2013-02-15 10:57:24 UTC
I followed the directions and the problem persists.  
~/netbeans-7.3rc2/bin$ sh netbeans --userdir /home/nbtest

When the IDE started I opened a js file and verified that nothing was collapsed.  I then went into options, enabled 'Collapse by Default'->'Methods' and then re-opened the js file.  It immediately collapsed all the functions and when I opened the $(document).ready(function() {} at the top of the script there were two instances of code in curly braces and both were collapsed.  That was true of the rest of the file and of the other js files that I checked.

I tested the six 'Collapse by Default' options and only 'Methods' caused this error to occur.
Comment 7 Petr Pisl 2013-02-18 13:54:03 UTC
Thanks for the clarification. I can reproduce it now. I can reproduce it with this code for example:

$(document).ready(function() {
  var test = {
      getName : function () {
          
      }
  };  
  function Martin (text) {
      if (text === 'test') {
          text = text + " one";
      } else {
          text = text + " two";
      }
  }  
});
Comment 8 Petr Pisl 2013-03-04 18:09:14 UTC
Should be fixed in web-main.
http://hg.netbeans.org/web-main/rev/672187f58ec3
Comment 9 Quality Engineering 2013-03-05 01:49:28 UTC
Integrated into 'main-golden', will be available in build *201303042300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/672187f58ec3
User: Petr Pisl <ppisl@netbeans.org>
Log: #226142 - Javascript Code Folding Error
Comment 10 Petr Pisl 2013-03-05 08:23:11 UTC
Reporter, could you please test it in a dev build. It will be probably part of the dev build tomorrow. You can download it from http://bits.netbeans.org/download/trunk/nightly/latest/

Thank you for your help
Comment 11 wnjordan 2013-03-18 19:15:11 UTC
I can confirm that this is resolved in 7.3.