Bug 194774 - Missing support for folding function expressions
Missing support for folding function expressions
Status: NEW
Product: javascript
Classification: Unclassified
Component: Editor
6.x
PC Linux
: P3 with 2 votes (vote)
: TBD
Assigned To: Petr Pisl
issues@javascript
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-27 14:09 UTC by hasenstein
Modified: 2011-08-01 07:34 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hasenstein 2011-01-27 14:09:42 UTC
First, I could not test NB7.0-Beta, because it only produced errors in a while(true) kind of loop that I was unable to break out of (whenever I closed an error window it would just pop up fresh).


The issue: There is only very incomplete code folding for Javascript function expressions.

What works:

var o = {
  func1: function () {
    ...
  },
  func2: function () {
    ...
  }
}

Code folding is provided at both func1 and func2.

What doeesn't work:

var func1 = function () {
  ...
};

There is no folding! Also, for ANY other place where there are function expressions (i.e. functions with no name as in "function NAME () {}") no code folding is offered!

However, function expressions are VITAL for programming in JS. It is not acceptable to have to provide a name only because Netbeans otherwise doesn't provide folding.

Thanks!!!


PS: The complete background for Javascript function expressions vs. function declarations:
- http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/
- http://kangax.github.com/nfe/
Comment 1 hasenstein 2011-01-27 14:12:13 UTC
UPDATE: I forgot to mention the most important reason besides "looks" why being forced to name functions in function expressions is the buggy implementation of this case in IE - see the first provided URL for a description. In essence, I have to live without folding or may have to live with serious side effects when the code runs in IE.
Comment 2 damirsecki 2011-08-01 07:34:45 UTC
I am confused why netbeans in version 7 still doesn't support jQuery... specially for code folding...

I have code snippets like this...

$('#something').click(function(e)){
   ....
});
and of course I'd like my code to be folded, so it would be more readable...

I also tried with cosum fold tags like

`//<editor-fold  defaultstate="collapsed" desc="el click">
   .... 
//</editor-fold>`
that strangly doesn't work in javascript (only in java I suppose)...

same thing goes for JS singletons...

Please advise, how can I fold some snippets in JS with netbeans

just to be clear, I already activated all options in NB settings for code folding(In reply to comment #0)
> First, I could not test NB7.0-Beta, because it only produced errors in a
> while(true) kind of loop that I was unable to break out of (whenever I closed
> an error window it would just pop up fresh).
> 
> 
> The issue: There is only very incomplete code folding for Javascript function
> expressions.
> 
> What works:
> 
> var o = {
>   func1: function () {
>     ...
>   },
>   func2: function () {
>     ...
>   }
> }
> 
> Code folding is provided at both func1 and func2.
> 
> What doeesn't work:
> 
> var func1 = function () {
>   ...
> };
> 
> There is no folding! Also, for ANY other place where there are function
> expressions (i.e. functions with no name as in "function NAME () {}") no code
> folding is offered!
> 
> However, function expressions are VITAL for programming in JS. It is not
> acceptable to have to provide a name only because Netbeans otherwise doesn't
> provide folding.
> 
> Thanks!!!
> 
> 
> PS: The complete background for Javascript function expressions vs. function
> declarations:
> - http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/
> - http://kangax.github.com/nfe/

(In reply to comment #0)
> First, I could not test NB7.0-Beta, because it only produced errors in a
> while(true) kind of loop that I was unable to break out of (whenever I closed
> an error window it would just pop up fresh).
> 
> 
> The issue: There is only very incomplete code folding for Javascript function
> expressions.
> 
> What works:
> 
> var o = {
>   func1: function () {
>     ...
>   },
>   func2: function () {
>     ...
>   }
> }
> 
> Code folding is provided at both func1 and func2.
> 
> What doeesn't work:
> 
> var func1 = function () {
>   ...
> };
> 
> There is no folding! Also, for ANY other place where there are function
> expressions (i.e. functions with no name as in "function NAME () {}") no code
> folding is offered!
> 
> However, function expressions are VITAL for programming in JS. It is not
> acceptable to have to provide a name only because Netbeans otherwise doesn't
> provide folding.
> 
> Thanks!!!
> 
> 
> PS: The complete background for Javascript function expressions vs. function
> declarations:
> - http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/
> - http://kangax.github.com/nfe/


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