mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Print colon in AA before identifiers
This commit is contained in:
parent
58b2c6ebc6
commit
d100c40dab
11 changed files with 56 additions and 6 deletions
|
@ -805,6 +805,11 @@ private:
|
|||
newline();
|
||||
}
|
||||
}
|
||||
else if (indents.topIs(tok!"]")) // Associative array
|
||||
{
|
||||
write(config.dfmt_space_before_aa_colon ? " : " : ": ");
|
||||
++index;
|
||||
}
|
||||
else if (peekBackIs(tok!"identifier")
|
||||
&& [tok!"{", tok!"}", tok!";", tok!":", tok!","]
|
||||
.any!((ptrdiff_t token) => peekBack2Is(cast(IdType)token, true))
|
||||
|
@ -838,12 +843,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
const inAA = indents.topIs(tok!"]") && indents.topDetails.breakEveryItem;
|
||||
|
||||
if (inAA && !config.dfmt_space_before_aa_colon)
|
||||
write(": ");
|
||||
else
|
||||
write(" : ");
|
||||
write(" : ");
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
8
tests/allman/issue0465.d.ref
Normal file
8
tests/allman/issue0465.d.ref
Normal file
|
@ -0,0 +1,8 @@
|
|||
bool asdf(const string owner, const string mail) @safe
|
||||
{
|
||||
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||
request.writeFormBody([owner: owner, mail: mail]);
|
||||
}, (scope HTTPClientResponse response) {});
|
||||
|
||||
return true;
|
||||
}
|
5
tests/allman/issue0485.d.ref
Normal file
5
tests/allman/issue0485.d.ref
Normal file
|
@ -0,0 +1,5 @@
|
|||
void main()
|
||||
{
|
||||
int a;
|
||||
int[int] hashmap = [a : a, a : a, a : a];
|
||||
}
|
4
tests/allman/issue0501.d.ref
Normal file
4
tests/allman/issue0501.d.ref
Normal file
|
@ -0,0 +1,4 @@
|
|||
void main()
|
||||
{
|
||||
auto aa = ["aaa": 1, "bbb": 2];
|
||||
}
|
9
tests/issue0465.d
Normal file
9
tests/issue0465.d
Normal file
|
@ -0,0 +1,9 @@
|
|||
bool asdf(const string owner, const string mail) @safe
|
||||
{
|
||||
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||
request.writeFormBody([owner: owner, mail:
|
||||
mail]);
|
||||
}, (scope HTTPClientResponse response) {});
|
||||
|
||||
return true;
|
||||
}
|
1
tests/issue0485.args
Normal file
1
tests/issue0485.args
Normal file
|
@ -0,0 +1 @@
|
|||
--space_before_aa_colon true
|
5
tests/issue0485.d
Normal file
5
tests/issue0485.d
Normal file
|
@ -0,0 +1,5 @@
|
|||
void main()
|
||||
{
|
||||
int a;
|
||||
int[int] hashmap = [a : a, a : a, a : a];
|
||||
}
|
4
tests/issue0501.d
Normal file
4
tests/issue0501.d
Normal file
|
@ -0,0 +1,4 @@
|
|||
void main()
|
||||
{
|
||||
auto aa = ["aaa": 1, "bbb":2];
|
||||
}
|
7
tests/otbs/issue0465.d.ref
Normal file
7
tests/otbs/issue0465.d.ref
Normal file
|
@ -0,0 +1,7 @@
|
|||
bool asdf(const string owner, const string mail) @safe {
|
||||
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||
request.writeFormBody([owner: owner, mail: mail]);
|
||||
}, (scope HTTPClientResponse response) {});
|
||||
|
||||
return true;
|
||||
}
|
4
tests/otbs/issue0485.d.ref
Normal file
4
tests/otbs/issue0485.d.ref
Normal file
|
@ -0,0 +1,4 @@
|
|||
void main() {
|
||||
int a;
|
||||
int[int] hashmap = [a : a, a : a, a : a];
|
||||
}
|
3
tests/otbs/issue0501.d.ref
Normal file
3
tests/otbs/issue0501.d.ref
Normal file
|
@ -0,0 +1,3 @@
|
|||
void main() {
|
||||
auto aa = ["aaa": 1, "bbb": 2];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue