Skip to content

Commit 540eb4d

Browse files
committed
FIX #27
1 parent 55dcfb5 commit 540eb4d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CodeService/src/LuaFormatter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,13 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatIfStatement(std::shared_ptr<L
10761076
}
10771077

10781078
env->AddChild(FormatExpression(child, expression));
1079-
env->Add<KeepBlankElement>(1);
1079+
env->Add<KeepElement>(1);
10801080
break;
10811081
}
10821082
default:
10831083
{
10841084
DefaultHandle(child, env);
1085+
env->Add<KeepElement>(1);
10851086
break;
10861087
}
10871088
}

Test/test_script/format_text/wait_format/if.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ if a then return a --end
2323

2424
end
2525

26-
27-
28-
29-
30-
26+
if a --
27+
then
28+
end
3129

Test/test_script/format_text/wait_format_should_be/if.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ if a then return a --end
2222

2323

2424
end
25+
26+
if a --
27+
then
28+
end

0 commit comments

Comments
 (0)