Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CDT Formatter Options Missing

Hello again,

I've been digging around and found the rest of the source (or at least, more of it) and can now see that my initial question about blank lines was a bit naive. My goal now is to just stop it messing with lines - no fancy options to insert/remove them intelligently based on context, etc. This seems like an easy task, IE, make this JDT formatter option (the lowest one, only) a reality for CDT:

http://stuff.fredcooke.com/EclipseJDTBlankLinesFormatterPreserve99.png

I'm happy managing blank lines myself, it's not overly complicated :-)

I'll see if I can find a way to simply prevent it doing what it's currently doing, and make it optional. Any pointers on files/line numbers are welcome!

Likewise, any thoughts on the macro trailing white space weirdness are also welcome - no idea where to start with that one. I'm happy to file a bug report if someone can confirm that it's an issue, or regardless if it's the proper thing to do.

I assume that this is all that's involved? Please correct me if I'm wrong!

find ~/workspace/org.eclipse.cdt/ -type d -and -name formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.ui.tests/resources/formatter

I might take a peek at the JDT version and see if it's at all similar; perhaps I can learn something there too.

Regards,

Fred.


On Tue, Jan 22, 2013 at 6:08 PM, Fred Cooke <fred.cooke@xxxxxxxxx> wrote:
Hello All,

I've been sent here from the freenode IRC channel by a helpful character by the nick of "paulweb515" who said people like Doug, Sergey and Andrew, etc are never in IRC.

I have an embedded project which people are wanting to commit to, which is a good thing TM, however my source is all hand formatted to perfection, and others are not so careful... I tried, about 3 or 4 years ago, to make a CDT formatter def that worked for me without introducing change that I didn't want, and failed horribly. I've just tried again, and come close to success, which is great! CDT rocks, btw! Much thanks for a top job! I've only played with one file so far, so other things may pop up, however my two complaints so far are these:

1) blank lines, no config for these at all, all block separation line chunks are reduced to one blank line. Not OK. I dug into the source just now and found that all of the blank line options are commented out in (at least) two files:

//    /**
//     * <pre>
//     * FORMATTER / Option to add blank lines before a new chunk
//     *     - option id:         "org.eclipse.cdt.core.
formatter.blank_lines_before_new_chunk"
//     *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
//     *     - default:           "0"
//     * </pre>
//     */
//    public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_new_chunk"; //$NON-NLS-1$

and

//    public int blank_lines_after_includes;
//    public int blank_lines_at_beginning_of_method_body;
//    public int blank_lines_before_field;
//    public int blank_lines_before_first_class_body_declaration;
//    public int blank_lines_before_includes;
//    public int blank_lines_before_member_type;
//    public int blank_lines_before_method;

etc.

Why? What would it take to bring these to life in the next version? :-)

2) I have a macro in an _expression_ that ends up with a space after it, and I can't find where to turn that off:

....vedVars->Lambda) / LAMBDA(1.0) ) * fixed.... << do not want/hate
....vedVars->Lambda) / LAMBDA(1.0)) * fixed.... << want

LAMBDA is a macro that scales the real world number for me. If I replace it with a literal such as 666 it does not insert a space. Likewise if I call a function in there (ending with a ')' also) it also does not insert a space. This seems like a bug to me. Thoughts?

Keep up the good work, one and all!

Regards,

Fred.


Back to the top