After having put up with the pain of Evergreen's dreadful
auto-indentation for 8 years, I finally decided to bite the bullet and
get on with fixing it. It was about time.
Today I had a go at putting together a first version of 'proper'
C-family indentation. I'm attaching a patch file to this email which
should be applied to a current version of the salma-hayek library.
You may need to update SH and Evergreen repositories, as I added
support for indenter preferences a week or so ago, which is needed for
the patch to work.
The patch will give you some configuration options which, for the
moment, need to be configured by hand using the good old-fashioned
'edit a text file' method.
For example, on my mac laptop, I have a file called
~/Library/Preferences/e.edit.Edit/file-type-preferences, whose
contents are:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<preferences>
<setting key="C++.alignFunctionArgs">true</setting>
<setting key="C++.namespaceIndent"></setting>
<setting key="C++.braceIndent"> </setting>
<setting key="C++.squareBracketIndent"> </setting>
<setting key="C++.parenthesisIndent"> </setting>
<setting key="C++.switchLabelOutdent"></setting>
<setting key="C++.accessSpecifierOutdent"> </setting>
<setting key="Java.alignFunctionArgs">false</setting>
<setting key="Java.braceIndent"> </setting>
<setting key="Java.squareBracketIndent"> </setting>
<setting key="Java.parenthesisIndent"> </setting>
<setting key="Java.switchLabelOutdent"> </setting>
</preferences>
This gives me Google-style C++, with Jessies-style Java. Well, more or less.
What you should notice is an improvement in the way multi-line code is
formatted. For example:
if (x &&
y &&
z) {
doStuff();
}
...should just come out correctly. Nice for those of us having to
cope with backward 80col coding styles.
There are going to be some bugs. A few known ones include:
1: In Java, stuff like this:
@Override
int someFunction() {
...will be formatted wrongly because the code assumes a line
continuation between the @Override and the 'int', so the 'int
someFunction' is indented too much.
2: In C++, something goes wrong with stuff like this:
std::cout << "Hello"
<< " "
<< "World!\n";
xxx <-- this line is now indented in too far.
Some odd things happen with switch statements too. Switch statements
are an absolute git.
Anyway, bug reports very welcome. Also, votes very welcome indeed.
The big question (at least, from my point of view) is the following.
Votes of A, B or C please:
A: This is worse than the existing auto-indentation for my use case,
and will waste my time.
B: This is not significantly worse than the current system, and I can
cope with minor glitches for a while.
C: This is better than the current system, and even with its bugs,
will already help me.
All the best,
Phil
Hey all.
All the best,
Phil
--
You received this message because you are subscribed to the Google Groups "evergreen-users" group.
To post to this group, send email to evergre...@googlegroups.com.
To unsubscribe from this group, send email to evergreen-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/evergreen-users?hl=en.
2 is the google style guide value. Probably just an oversight because that was convenient for his testing. I can confirm that the dialog is broken for me too, but only by experiment, not because I've looked at the source.