mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 325783 - [formatter] Function call arguments' indentation is wrong if there is a templated argument
This commit is contained in:
parent
918eb1278a
commit
214b66c248
2 changed files with 32 additions and 0 deletions
|
@ -173,6 +173,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
public boolean fSpaceBetweenEmptyParen;
|
public boolean fSpaceBetweenEmptyParen;
|
||||||
public boolean fSpaceBeforeOpeningParen;
|
public boolean fSpaceBeforeOpeningParen;
|
||||||
public int fContinuationIndentation= -1;
|
public int fContinuationIndentation= -1;
|
||||||
|
public int fTieBreakRule = Alignment.R_INNERMOST;
|
||||||
public ListAlignment(int mode) {
|
public ListAlignment(int mode) {
|
||||||
fMode= mode;
|
fMode= mode;
|
||||||
}
|
}
|
||||||
|
@ -1013,6 +1014,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
scribe.startNewLine();
|
scribe.startNewLine();
|
||||||
scribe.indent();
|
scribe.indent();
|
||||||
final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
|
final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
|
||||||
|
align.fTieBreakRule = Alignment.R_OUTERMOST;
|
||||||
formatList(Arrays.asList(constructorChain), align, false, false);
|
formatList(Arrays.asList(constructorChain), align, false, false);
|
||||||
scribe.unIndent();
|
scribe.unIndent();
|
||||||
}
|
}
|
||||||
|
@ -1135,6 +1137,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
align.fSpaceBetweenEmptyParen= preferences.insert_space_between_empty_parens_in_method_declaration;
|
align.fSpaceBetweenEmptyParen= preferences.insert_space_between_empty_parens_in_method_declaration;
|
||||||
align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_method_declaration_parameters;
|
align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_method_declaration_parameters;
|
||||||
align.fSpaceAfterComma= preferences.insert_space_after_comma_in_method_declaration_parameters;
|
align.fSpaceAfterComma= preferences.insert_space_after_comma_in_method_declaration_parameters;
|
||||||
|
align.fTieBreakRule = Alignment.R_OUTERMOST;
|
||||||
formatList(parameters, align, true, node.takesVarArgs());
|
formatList(parameters, align, true, node.takesVarArgs());
|
||||||
|
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
|
@ -1655,6 +1658,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
||||||
Alignment listAlignment = scribe.createAlignment(
|
Alignment listAlignment = scribe.createAlignment(
|
||||||
"listElements_"+align, //$NON-NLS-1$
|
"listElements_"+align, //$NON-NLS-1$
|
||||||
align.fMode,
|
align.fMode,
|
||||||
|
align.fTieBreakRule,
|
||||||
elementsLength + (addEllipsis ? 1 : 0),
|
elementsLength + (addEllipsis ? 1 : 0),
|
||||||
scribe.scanner.getCurrentPosition(),
|
scribe.scanner.getCurrentPosition(),
|
||||||
continuationIndentation,
|
continuationIndentation,
|
||||||
|
|
|
@ -1366,4 +1366,32 @@ public class CodeFormatterTest extends BaseUITestCase {
|
||||||
assertFormatterResult();
|
assertFormatterResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
||||||
|
|
||||||
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters,
|
||||||
|
// const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label,
|
||||||
|
// double avg, double maxh, double max_dist_double_bond);
|
||||||
|
public void testWrappingOfTemplateIdAsParameterType_Bug325783() throws Exception {
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
|
||||||
|
Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "120");
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
||||||
|
|
||||||
|
//void extend_terminal_bond_to_label(vector<atom_t> &atom,
|
||||||
|
// const vector<letters_t> &letters,
|
||||||
|
// int n_letters, const vector<bond_t> &bond,
|
||||||
|
// int n_bond, const vector<label_t> &label,
|
||||||
|
// int n_label, double avg, double maxh,
|
||||||
|
// double max_dist_double_bond);
|
||||||
|
public void testWrappingOfTemplateIdAsParameterType_Bug325783_2() throws Exception {
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
|
||||||
|
Integer.toString(Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN));
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "80");
|
||||||
|
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
|
||||||
|
assertFormatterResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue