mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Don't indent associative array keys as labels
This commit is contained in:
parent
c4b6a7e7e3
commit
1f21a97713
5 changed files with 26 additions and 2 deletions
|
@ -1694,8 +1694,8 @@ private:
|
|||
assert(l2 != -1, "Recent '{' is not found despite being in struct initializer");
|
||||
indentLevel = l2 + 1;
|
||||
}
|
||||
else if (config.dfmt_compact_labeled_statements == OptionalBoolean.f
|
||||
|| !isBlockHeader(2) || peek2Is(tok!"if"))
|
||||
else if ((config.dfmt_compact_labeled_statements == OptionalBoolean.f
|
||||
|| !isBlockHeader(2) || peek2Is(tok!"if")) && !indents.topIs(tok!"]"))
|
||||
{
|
||||
immutable l2 = indents.indentToMostRecent(tok!"{");
|
||||
indentLevel = l2 != -1 ? l2 : indents.indentLevel - 1;
|
||||
|
|
8
tests/allman/assoc_key_indent.d.ref
Normal file
8
tests/allman/assoc_key_indent.d.ref
Normal file
|
@ -0,0 +1,8 @@
|
|||
void main()
|
||||
{
|
||||
string key;
|
||||
|
||||
int[string] var = [
|
||||
key: 5
|
||||
];
|
||||
}
|
1
tests/assoc_key_indent.args
Normal file
1
tests/assoc_key_indent.args
Normal file
|
@ -0,0 +1 @@
|
|||
--keep_line_breaks=true
|
8
tests/assoc_key_indent.d
Normal file
8
tests/assoc_key_indent.d
Normal file
|
@ -0,0 +1,8 @@
|
|||
void main()
|
||||
{
|
||||
string key;
|
||||
|
||||
int[string] var = [
|
||||
key: 5
|
||||
];
|
||||
}
|
7
tests/otbs/assoc_key_indent.d.ref
Normal file
7
tests/otbs/assoc_key_indent.d.ref
Normal file
|
@ -0,0 +1,7 @@
|
|||
void main() {
|
||||
string key;
|
||||
|
||||
int[string] var = [
|
||||
key: 5
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue