mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
Fix issue 483: indent continuing case statements on the same level
This commit is contained in:
parent
e4f2f20720
commit
b5dbb0e031
5 changed files with 52 additions and 1 deletions
|
@ -1715,7 +1715,14 @@ private:
|
|||
}
|
||||
else if (currentIs(tok!"case") || currentIs(tok!"default"))
|
||||
{
|
||||
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true))
|
||||
|
||||
if (peekBackIs(tok!"}", true) || peekBackIs(tok!";", true)
|
||||
/**
|
||||
* The following code is valid and should be indented flatly
|
||||
* case A:
|
||||
* case B:
|
||||
*/
|
||||
|| peekBackIs(tok!":", true))
|
||||
{
|
||||
indents.popTempIndents();
|
||||
if (indents.topIs(tok!"case"))
|
||||
|
|
15
tests/allman/issue0483.d.ref
Normal file
15
tests/allman/issue0483.d.ref
Normal file
|
@ -0,0 +1,15 @@
|
|||
module tests.issue0483;
|
||||
|
||||
void main()
|
||||
{
|
||||
switch (0)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
label:
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
1
tests/issue0483.args
Normal file
1
tests/issue0483.args
Normal file
|
@ -0,0 +1 @@
|
|||
--align_switch_statements=false
|
15
tests/issue0483.d
Normal file
15
tests/issue0483.d
Normal file
|
@ -0,0 +1,15 @@
|
|||
module tests.issue0483;
|
||||
|
||||
void main()
|
||||
{
|
||||
switch (0)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
label:
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
13
tests/otbs/issue0483.d.ref
Normal file
13
tests/otbs/issue0483.d.ref
Normal file
|
@ -0,0 +1,13 @@
|
|||
module tests.issue0483;
|
||||
|
||||
void main() {
|
||||
switch (0) {
|
||||
case 1:
|
||||
case 2:
|
||||
label:
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue