1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Improved formatting of function calls.

This commit is contained in:
Sergey Prigogin 2011-03-16 00:42:31 +00:00
parent b131a8f06b
commit 199adb3ec5
2 changed files with 28 additions and 1 deletions

View file

@ -272,6 +272,12 @@ public class Alignment {
case M_COMPACT_SPLIT:
i = this.fragmentIndex;
do {
if (i == 0 && (mode & M_INDENT_ON_COLUMN) != 0 &&
name.startsWith(LIST_ELEMENTS_PREFIX)) {
// Don't split the line before the first element of the list if the list
// elements are indented on column.
break;
}
if (this.fragmentBreaks[i] == NONE) {
this.fragmentBreaks[i] = BREAK;
this.fragmentIndentations[i] = this.breakIndentationLevel;

View file

@ -1054,11 +1054,32 @@ public class CodeFormatterTest extends BaseUITestCase {
// f1(100000, 200000, 300000, 400000, 500000,
// f2(10, 20, 30, 40, 50, 60, 70000), 700000);
//}
public void testFunctionCall() throws Exception {
public void testFunctionCall_1() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
assertFormatterResult();
}
//int function(int, int, int, int, int);
//int function_with_a_long_name(int, int);
//
//void test() {
//function_with_a_long_name(function(1000000, 2000000, 3000000, 4000000, 5000000), 6000000);
//}
//int function(int, int, int, int, int);
//int function_with_a_long_name(int, int);
//
//void test() {
// function_with_a_long_name(function(1000000, 2000000, 3000000, 4000000,
// 5000000), 6000000);
//}
public void testFunctionCall_2() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
assertFormatterResult();
}
//void function(const char* s);
//
//void test() {