Formatter: unwanted new lines, Typing: unwanted comment closure [message #1724777] |
Thu, 25 February 2016 23:33 |
g4rb4g3 ju1c3 Messages: 3 Registered: February 2016 |
Junior Member |
|
|
I've scoured Eclipse and searched the internet for hours trying to find a way to turn a couple of things off...
Linux Mint 17.1
Eclipse version: Mars.1 Release (4.5.1)
Eclipse build id: 20150924-1200
CDT version 8.8.0
The formatter is being a bit stupid with line breaks. This:
void LetsIncrementForNoReason(void)
{
int a, b, c, d;
for (a = 0; a < 42; a++) {
b = c = d++;
}
}
turns into:
void LetsIncrementForNoReason(void)
{
int
a,
b,
c,
d;
for (a = 0;
a < 42;
a++) {
b = c = d++;
}
}
The formatter is amazing for making other people's code readable, but this is just silly. The closest thing I can find is under White Space when editing the formatter profile. I can see the example code formatted like this but I see no option for new lines. In fact the whole New Lines tab is suspiciously empty aside from one check box and only shows C++ example code...
When starting a block comment with /* and pressing enter, comment is automatically closed around the new line as in:
/*<enter> CodeToCommentOut();
turns into:
/*
* <cursor>
*/ CodeToCommentOut();
This is great and all, but as you can see I'm not necessarily intending to write an actual comment. Yes, I know about the automatic code commenting feature, but I'd rather not be forced to use it. I've tried disabling every comment related option I can find and it still does it.
Is it possible to turn these features off? I really like Eclipse and this isn't stopping me from using it, but it's really annoying.
Thanks...
|
|
|
|
Re: Formatter: unwanted new lines, Typing: unwanted comment closure [message #1724961 is a reply to message #1724882] |
Sun, 28 February 2016 05:48 |
g4rb4g3 ju1c3 Messages: 3 Registered: February 2016 |
Junior Member |
|
|
Thanks Jonah. You pointed me in the right direction to figure out the line break problem:
On the Line Wrapping tab I had everything set to 'Do not wrap', except enumerations which I forced to wrap so every element is on a separate line ('Wrap all elements...' and 'Force split...'). Apparently this ignores the maximum line width, but I also assumed anything set to 'Do not wrap' would also ignore it. Now that I do think about it, I'm not sure it should. Seems like a bug to me. Regardless, the problem was that I had the maximum line width set to 0, thinking that would mean unlimited. The solution was to set it to 9999. I'm not using a VT52 and I'd rather handle line breaks myself anyway. Thing is, 'Do not wrap' is now enforced. Any long lines like function declarations that are manually broken up at logical points get joined back together into one. This is easily averted with the 'Never join already wrapped lines' option however.
I didn't know about Shift+Enter, and that combined with Ctrl+Z is better, but still not quite what I'd like. I'm looking to put the comment start and close on their own separate lines with no * in front of everything. What I omitted to say was I'm usually commenting out multiple lines of code and what I'm doing is /*<enter> at the beginning of the first line, cursor down however far, and */<enter> at the beginning of the line after the last. Selecting lines and using Ctrl+Shift+/ produces what I'm looking for and isn't really that much more typing, I'm just not used to it. Seems weird there is no option for this. There's an 'Automatically close' section in the editor typing options, and seemingly everything except comments have an option to enable/disable automatic closure. I did have a quick look at the CDT source to see if I could easily disable (absolutely love open source for this) it but holy crap, there's a *lot* of code to wade through. Might be easier to make some suggestions to the developers...
Thanks for your help.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03072 seconds