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: | C/C++ reformatting settings and action issues | ||
---|---|---|---|
Product: | cnd | Reporter: | mfwiniberg <mfwiniberg> |
Component: | Editor | Assignee: | Alexander Simon <alexvsimon> |
Status: | NEW --- | ||
Severity: | blocker | ||
Priority: | P4 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 130923, 135699 | ||
Bug Blocks: | 154590 |
Description
mfwiniberg
2008-04-25 09:30:28 UTC
Multiple defects. Escalated to P2. fixed "braces placement/switch" example http://hg.netbeans.org/main/rev/3696e86699ff Integrated into 'main-golden', available in NB_Trunk_Production #221 build Changeset: http://hg.netbeans.org/main/rev/3696e86699ff User: Alexander Simon <alexvsimon@netbeans.org> Log: fixing: IZ#133909:C/C++ reformatting settings and action issues - extend example Example: if (!a) will reformat to if (!a ) was fixed in: http://www.netbeans.org/issues/show_bug.cgi?id=135699 Half of this bug is already fixed. Downgrading to P3. What still needs to be fixed: duplicate formatting style name and braces formatting. Fixed another part of this issue: prevented creation of styles with duplicate names. http://hg.netbeans.org/main/rev/84c6b82fcfc7 What still needs to be fixed: braces formatting. mfwiniberg, could you please provide examples of code that are formatted incorrectly? Hi Here is a single piece of code from one of my objects that indicates the inconsistency quite well. As the first initialiser is large, I have elided all but the first and last two lines, the second one I have left alone (sorry about the wrap)... field_data ff [] ={ { nFRCODE, &farecode, 0, "FARECODE", 'C', 3, 0 }, // User defined fare code { nFRDESC, &descr, 0, "DESCR", 'C', 40, 0 }, // and matching description { nFRSTO, &sto, 0, "STO", 'D', 8, 0 }, // STO dates { 0, 0, 0, 0, 0, 0, 0} }; tag_data ft [] ={ { &fareroute,"FARROUTE", "ROUTE", 0, 0, 0 }, { &faresec, "FARESEC", "ROUTE+DTOC(VFROM,1)+FARECODE", not_del, 0, 0 }, { &farebest, "FAREBEST", "ROUTE+DTOC(VFROM,1)+STR(99999.99 - ADULT,8,2)", "ISPAX .AND. .NOT. (FCLASS='E' .OR. FCLASS='S') .AND. .NOT. SPECIAL .AND. .NOT. WEBONLY", 0, 0}, { &fareval, "FAREVAL", "ADULT", not_del, 0, r4descending }, { &faredisc, "FAREDISC", "DTOC(VFROM,1)+ROUTE+FARECODE", "(FCLASS='E' .AND. SUBSTR(TAXACC,3,1)='D') .AND. .NOT. DELETED()", 0, 0}, { &farechgs, "FARECHGS", "DTOC(VFROM,1)+ROUTE+FARECODE", "(FCLASS='E' .AND. SUBSTR(TAXACC,3,1)<>'D') .AND. .NOT. DELETED()", 0, 0}, { &farextra, "FAREXTRA", "ROUTE+DTOC(VFROM,1)+FARECODE", "(FCLASS='E') .AND. .NOT. DELETED()", 0, 0}, { 0, 0, 0, 0, 0, 0 } }; reformats to: field_data ff [] = { { nFRCODE, &farecode, 0, "FARECODE", 'C', 3, 0}, // User defined fare code { nFRDESC, &descr, 0, "DESCR", 'C', 40, 0}, // and matching description { nFRSTO, &sto, 0, "STO", 'D', 8, 0}, // STO dates { 0, 0, 0, 0, 0, 0, 0} }; tag_data ft [] = { { &fareroute, "FARROUTE", "ROUTE", 0, 0, 0 }, { &faresec, "FARESEC", "ROUTE+DTOC(VFROM,1)+FARECODE", not_del, 0, 0 }, { &farebest, "FAREBEST", "ROUTE+DTOC(VFROM,1)+STR(99999.99 - ADULT,8,2)", "ISPAX .AND. .NOT. (FCLASS='E' .OR. FCLASS='S') .AND. .NOT. SPECIAL .AND. .NOT. WEBONLY", 0, 0}, { &fareval, "FAREVAL", "ADULT", not_del, 0, r4descending }, { &faredisc, "FAREDISC", "DTOC(VFROM,1)+ROUTE+FARECODE", "(FCLASS='E' .AND. SUBSTR(TAXACC,3,1)='D') .AND. .NOT. DELETED()", 0, 0}, { &farechgs, "FARECHGS", "DTOC(VFROM,1)+ROUTE+FARECODE", "(FCLASS='E' .AND. SUBSTR(TAXACC,3,1)<>'D') .AND. .NOT. DELETED()", 0, 0}, { &farextra, "FAREXTRA", "ROUTE+DTOC(VFROM,1)+FARECODE", "(FCLASS='E') .AND. .NOT. DELETED()", 0, 0}, { 0, 0, 0, 0, 0, 0 } }; The wrap is making it harder to see what happens, but in the second initialiser, some lines have the brackets moved and some don't - it's not immediately obvious why (to me anyway!)... The first initialiser gets reformatted much as I would expect, although it would be really nice to be able to set where the comments begin (the full source has 40 lines of varying length in that first initialiser and the comments become very hard to read). It would be even nicer to be able to specify that the formatter position to, say, the next tab stop, after each comma in such a list 8) thanks Mike Reassigning to our formatting guru for evaluation :) The rest part of issue rather is enchantment "adaptive formatting". I.e. detect user formatting style on fly. |