Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327559

Summary: have the CDT formatter respect 'indent' style no-format sections with the "*INDENT-OFF*" & "*INDENT-ON* tokens
Product: [Tools] CDT Reporter: Sagie <sagie>
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: CLOSED DUPLICATE QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: enhancement    
Priority: P3 CC: cbrown, cdtdoug, marco.stornelli, pong_ho80, sharon.dagan, tim.froidcoeur+eclipse, tryfon.farmakakis, waav_zoungla-efc7, zeratul976
Version: 7.0   
Target Milestone: 9.7.0   
Hardware: All   
OS: All   
Whiteboard:

Description Sagie CLA 2010-10-12 10:14:21 EDT
Build Identifier: 

enable code sections to be annotated with "/* *INDENT-OFF* */" & "/* *INDENT-ON* */ tokens to disable auto-formatting. This will enable protecting special code sections such as [1] which should be indented by hand.

referred section brought here for conveniences:

  static const struct linedraw cstable[]={
    { latin1_3,    "|  ",              "|--",            "&middot;--",     "&copy;"   },
    { iso8859_789, "|  ",              "|--",            "&middot;--",     "(c)"      },
    { shift_jis,   "\204\240 ",        "\204\245",       "\204\244",       "(c)"      },
    { euc_jp,      "\250\242 ",        "\250\247",       "\250\246",       "(c)"      },
    { euc_kr,      "\246\242 ",        "\246\247",       "\246\246",       "(c)"      },
    { iso2022jp,   "\033$B(\"\033(B ", "\033$B('\033(B", "\033$B(&\033(B", "(c)"      },
    { ibm_pc,      "\263  ",           "\303\304\304",   "\300\304\304",   "(c)"      },
    { ibm_ps2,     "\263  ",           "\303\304\304",   "\300\304\304",   "\227"     },
    { ibm_gr,      "\263  ",           "\303\304\304",   "\300\304\304",   "\270"     },
    { gb,          "\251\246 ",        "\251\300",       "\251\270",       "(c)"      },
    { utf8,        "\342\224\202\302\240\302\240",
                   "\342\224\234\342\224\200\342\224\200", "\342\224\224\342\224\200\342\224\200", "\302\251" },
    { big5,        "\242x ",           "\242u",          "\242|",          "(c)"      },
    { viscii,      "|  ",              "|--",            "`--",            "\371"     },
    { koi8ru,      "\201  ",           "\206\200\200",   "\204\200\200",   "\277"     },
    { windows,     "|  ",              "|--",            "`--",            "\251"     },
    { NULL,        "|  ",              "|--",            "`--",            "(c)"      }
  };


[1] ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz, file: tree.c, line: ~1766

Reproducible: Always
Comment 1 Anton Leherbauer CLA 2010-10-22 04:31:40 EDT
See also JDT bug 27079.
Comment 2 tim.froidcoeur+eclipse CLA 2011-04-07 07:38:52 EDT
JDT uses 
//@formatter:on 
and 
//@formatter:off

maybe it makes sense to honor these same directives?
Comment 3 Chris Brown CLA 2013-04-23 20:42:21 EDT
JDT also has this as a configurable option with the default being off.  I agree that CDT should follow the JDT defaults on this.
Comment 4 Marc Khouzam CLA 2015-07-15 13:37:58 EDT
*** Bug 453926 has been marked as a duplicate of this bug. ***
Comment 5 Nathan Ridge CLA 2017-01-10 20:28:56 EST
*** Bug 285900 has been marked as a duplicate of this bug. ***
Comment 6 Nathan Ridge CLA 2017-02-21 20:59:39 EST
*** Bug 419978 has been marked as a duplicate of this bug. ***
Comment 7 Marco Stornelli CLA 2019-02-20 01:08:38 EST
This bug has been already been fixed, (see but 496249).
Comment 8 Marco Stornelli CLA 2019-02-20 01:09:38 EST
I meant bug 496249
Comment 9 Nathan Ridge CLA 2019-02-20 03:19:39 EST
Thanks, closed as dupe.

*** This bug has been marked as a duplicate of bug 496249 ***