mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-05-07 19:26:27 +03:00
Revert chain indentation in an argument list
This commit is contained in:
parent
57f57d95de
commit
a4fbc6f881
11 changed files with 128 additions and 0 deletions
|
@ -1625,6 +1625,10 @@ private:
|
||||||
const commaLine = tokens[index].line;
|
const commaLine = tokens[index].line;
|
||||||
|
|
||||||
writeToken();
|
writeToken();
|
||||||
|
if (indents.topIs(tok!"."))
|
||||||
|
{
|
||||||
|
indents.pop;
|
||||||
|
}
|
||||||
if (!currentIs(tok!")") && !currentIs(tok!"]")
|
if (!currentIs(tok!")") && !currentIs(tok!"]")
|
||||||
&& !currentIs(tok!"}") && !currentIs(tok!"comment"))
|
&& !currentIs(tok!"}") && !currentIs(tok!"comment"))
|
||||||
{
|
{
|
||||||
|
@ -1643,6 +1647,10 @@ private:
|
||||||
{
|
{
|
||||||
pushWrapIndent();
|
pushWrapIndent();
|
||||||
writeToken();
|
writeToken();
|
||||||
|
if (indents.topIs(tok!"."))
|
||||||
|
{
|
||||||
|
indents.pop;
|
||||||
|
}
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
13
tests/allman/argument_chain_indent.d.ref
Normal file
13
tests/allman/argument_chain_indent.d.ref
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
class C
|
||||||
|
{
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
|
||||||
|
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
tests/allman/argument_chain_keep_breaks.d.ref
Normal file
15
tests/allman/argument_chain_keep_breaks.d.ref
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class C
|
||||||
|
{
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
f(
|
||||||
|
array.map!(a => a.prop)
|
||||||
|
.array
|
||||||
|
.to!string,
|
||||||
|
__FILE__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
tests/argument_chain_indent.args
Normal file
1
tests/argument_chain_indent.args
Normal file
|
@ -0,0 +1 @@
|
||||||
|
--single_indent=true
|
28
tests/argument_chain_indent.d
Normal file
28
tests/argument_chain_indent.d
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
class C
|
||||||
|
{
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
f(
|
||||||
|
map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__FILE__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
tests/argument_chain_keep_breaks.args
Normal file
2
tests/argument_chain_keep_breaks.args
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
--single_indent=true
|
||||||
|
--keep_line_breaks=true
|
15
tests/argument_chain_keep_breaks.d
Normal file
15
tests/argument_chain_keep_breaks.d
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class C
|
||||||
|
{
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
f(
|
||||||
|
array.map!(a => a.prop)
|
||||||
|
.array
|
||||||
|
.to!string,
|
||||||
|
__FILE__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
tests/knr/argument_chain_indent.d.ref
Normal file
11
tests/knr/argument_chain_indent.d.ref
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class C {
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true) {
|
||||||
|
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
|
||||||
|
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
tests/knr/argument_chain_keep_breaks.d.ref
Normal file
13
tests/knr/argument_chain_keep_breaks.d.ref
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
class C {
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
if (true) {
|
||||||
|
f(
|
||||||
|
array.map!(a => a.prop)
|
||||||
|
.array
|
||||||
|
.to!string,
|
||||||
|
__FILE__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
tests/otbs/argument_chain_indent.d.ref
Normal file
10
tests/otbs/argument_chain_indent.d.ref
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class C {
|
||||||
|
void f() {
|
||||||
|
if (true) {
|
||||||
|
f(map.map.map.map.map.map.map.map.map.map.map.map.map.map.map.map
|
||||||
|
.map.map.map.map.map.map, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __FILE__,
|
||||||
|
__FILE__, __FILE__, __FILE__, __FILE__, __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
tests/otbs/argument_chain_keep_breaks.d.ref
Normal file
12
tests/otbs/argument_chain_keep_breaks.d.ref
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
class C {
|
||||||
|
void f() {
|
||||||
|
if (true) {
|
||||||
|
f(
|
||||||
|
array.map!(a => a.prop)
|
||||||
|
.array
|
||||||
|
.to!string,
|
||||||
|
__FILE__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue