Skip to content

Commit 2efc873

Browse files
committed
fix error
1 parent a64453b commit 2efc873

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

CodeService/src/LuaFormatter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatExpressionList(std::shared_pt
642642
std::shared_ptr<FormatElement> LuaFormatter::FormatCallArgsExpressionList(std::shared_ptr<LuaAstNode> expressionList,
643643
std::shared_ptr<FormatElement> env)
644644
{
645+
if (env == nullptr)
646+
{
647+
env = std::make_shared<LongExpressionLayoutElement>(_options.continuation_indent_size);
648+
}
649+
645650
auto& children = expressionList->GetChildren();
646651
for (auto& node : children)
647652
{

Test/test_script/format_text/wait_format/function.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,15 @@ function f3()
1818
local function f() end
1919

2020
end
21+
22+
local dd = function()
23+
24+
local t = 13
25+
26+
end
27+
28+
--extend syntax
29+
local function f2(aaa,bbb,ccc,)
30+
end
31+
32+
f2(1,2,3,)

Test/test_script/format_text/wait_format_should_be/function.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ function f3()
1919
local function f() end
2020

2121
end
22+
23+
local dd = function()
24+
local t = 13
25+
end
26+
27+
--extend syntax
28+
local function f2(aaa, bbb, ccc)
29+
end
30+
31+
f2(1, 2, 3)

0 commit comments

Comments
 (0)