Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 198424 - Formatting: "Format indentation"
Formatting: "Format indentation"
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Formatting & Indentation
7.0
All All
: P2 with 1 vote (vote)
: 7.4
Assigned To: Dusan Balek
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-08 03:16 UTC by pekarna
Modified: 2013-05-06 07:51 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pekarna 2011-05-08 03:16:46 UTC
Very often, people use formatting to fix indentation, because everyone has different indentation settings, which leads to total chaos in tabs/spaces mixture.

However, formatter sometimes breaks hand-made formatting which fits the given code better - e.g. inline get/setters, space-aligned anonymous inner classes, etc.

My suggestion is:

Add a "Format indentation" which would _only_ reformat the leading spaces and tabs, taking the level of current structure depth into account.

E.g.:

     class Hello {
    public String getNote() {
 return note; }
     public void setNote( String note ) { this.note = note;
}
   }

would become
 
class Hello {
    public String getNote() {
        return note; }
    public void setNote( String note ) { this.note = note;
    }
}

and NOT

class Hello {

    public String getNote()
    {
        return note;
    }

    public void setNote( String note )
    {
        this.note = note;
    }
}

Thanks for considering.
Comment 1 pekarna 2011-05-08 03:39:08 UTC
Just found that in Options > Editor > Code Templates, there's
"On Template Expansion: Reindent Text", so perhaps there's already some code regarding re-indentation (if it's not simply "add as the same whitespace string to each line of the macro as is on the previous line" algorithm).
Comment 2 Dusan Balek 2013-05-06 07:51:15 UTC
Fixed in jet-main. Indent action added (without any shortcut initially assigned).

http://hg.netbeans.org/jet-main/rev/84747192f415


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