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: | Enhance javascript array indentation options | ||
---|---|---|---|
Product: | javascript | Reporter: | powellke <powellke> |
Component: | Formatting & Indentation | Assignee: | Petr Pisl <ppisl> |
Status: | NEW --- | ||
Severity: | normal | CC: | jdavidbakr, kosmonaffft, powellke |
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | IDE log |
Description
powellke
2013-02-11 17:19:22 UTC
Created attachment 131256 [details]
IDE log
Basically there was no formatter in 7.2, just some basic reindentation. Can you narrow your samples? What particular thing you don't like? Is it the array indentation? Yes. The main thing that stood out as different is the way arrays of objects are indented. I prefer this: items: [{ name: 'Keith', age: 40 }, { name: 'Frank', age: 52 }] over this: items: [{ name: 'Keith', age: 40 }, { name: 'Frank', age: 52 }] If I put the opening and closing curly brackets on lines by themselves, the indention make sense. It's just different than I'm used to. items: [ { name: 'Keith', age: 40 }, { name: 'Frank', age: 52 } ] I like that the formatter properly indents simple arrays such as: requires: [ 'Ext.panel.Panel', 'Ext.form.field.Checkbox' ] Thanks. (In reply to comment #2) > Basically there was no formatter in 7.2, just some basic reindentation. > > Can you narrow your samples? What particular thing you don't like? Is it the > array indentation? I've been playing with the RC for 7.3 (love the new features btw) but I'm running into this issue with the javascript formatter doing strange things as well. I'm using MooTools library and compiling it via Packager. This requires something like this at the top of each js file: /* --- provides: PackageName requires: - Core/Options - Core/Events - Core/Fx.Tween ... */ The packager is pretty picky about not having any space on the line before the "---", "provides", "requires", and "..." lines. The 7.2 version left these comment blocks as they were, but re-formatting the comment blocks are breaking my scripts. I'd personally prefer that the stuff inside comment blocks be left alone by any formatter. I've noticed that I get some wonky indentations when I carriage return into a new line as well, but haven't studied it enough to know what is happening. I will say it seems to occur an awful lot when I'm inside of an object (i.e. deep in some MooTools class functions) (In reply to comment #4) Please always file a separate issue. Do not hijack issue filed for different problem. > I've been playing with the RC for 7.3 (love the new features btw) but I'm > running into this issue with the javascript formatter doing strange things as > well. I'm using MooTools library and compiling it via Packager. This requires > something like this at the top of each js file: > > /* > --- > provides: PackageName > requires: > - Core/Options > - Core/Events > - Core/Fx.Tween > ... > */ > > The packager is pretty picky about not having any space on the line before the > "---", "provides", "requires", and "..." lines. The 7.2 version left these > comment blocks as they were, but re-formatting the comment blocks are breaking > my scripts. I'd personally prefer that the stuff inside comment blocks be left > alone by any formatter. Fixed as issue #226282. > > I've noticed that I get some wonky indentations when I carriage return into a > new line as well, but haven't studied it enough to know what is happening. I > will say it seems to occur an awful lot when I'm inside of an object (i.e. deep > in some MooTools class functions) It is indenter related. Please file an issue with a reproducible test case. Thanks. *** Bug 231318 has been marked as a duplicate of this bug. *** In 7.4 Objects are not indented at all! Only functions (function($) { $.widget("zevero.desktop", { // Default options. options: { topHeight:35, bottomHeight:30, iconWidth:100, iconHeight:100, menu: [ {text: 'Design', click: function() { $('#jud-design').toggle(); }, right:true } ... thats just horrible! However in the preview its just working fine! (Would be nice if it was editable, so I could look whats the difference) (In reply to severo from comment #7) > In 7.4 > Objects are not indented at all! > Only functions > > > (function($) { > > $.widget("zevero.desktop", { > // Default options. > options: { > topHeight:35, > bottomHeight:30, > iconWidth:100, > iconHeight:100, > menu: [ > {text: 'Design', click: function() { > $('#jud-design').toggle(); > }, right:true } > ... > > thats just horrible! > > However in the preview its just working fine! (Would be nice if it was > editable, so I could look whats the difference) Please do not hijack issues. File a separate one. As far as I can tell your sample works ok in today daily build. Please provide a full steps to reproduce. |