Skip to content

Commit 76cdc84

Browse files
committed
允许选项 align_call_args 的值为 only_not_exist_cross_row_expression
1 parent 5880032 commit 76cdc84

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CodeService/src/LuaEditorConfig.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ void LuaEditorConfig::ParseFromSection(std::shared_ptr<LuaCodeStyleOptions> opti
276276
{
277277
options->align_call_args = AlignCallArgs::OnlyAfterMoreIndentionStatement;
278278
}
279+
else if(value == "only_not_exist_cross_row_expression")
280+
{
281+
options->align_call_args = AlignCallArgs::OnlyNotExistCrossExpression;
282+
}
279283
}
280284

281285
if (configMap.count("align_chained_expression_statement"))

CodeService/src/LuaFormatter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,9 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatCallArgList(std::shared_ptr<L
12611261
if (!expression->GetChildren().empty())
12621262
{
12631263
auto first = expression->GetChildren().front();
1264-
if (first->GetType() == LuaAstNodeType::ClosureExpression || first->GetType() ==
1265-
LuaAstNodeType::TableExpression)
1264+
if (first->GetType() == LuaAstNodeType::ClosureExpression
1265+
|| first->GetType() == LuaAstNodeType::TableExpression
1266+
|| _options.align_call_args == AlignCallArgs::OnlyNotExistCrossExpression)
12661267
{
12671268
canAligned = false;
12681269
break;

include/CodeService/LuaCodeStyleEnum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ enum class AlignCallArgs
2626
{
2727
True,
2828
False,
29-
OnlyAfterMoreIndentionStatement
29+
OnlyAfterMoreIndentionStatement,
30+
OnlyNotExistCrossExpression,
3031
};

lua.template.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ insert_final_newline = true
3030
# [function]
3131

3232
# function call expression's args will align to first arg
33-
# optional true/false/only_after_more_indention_statement
33+
# optional true/false/only_after_more_indention_statement/only_not_exist_cross_row_expression
3434
align_call_args = false
3535

3636
# if true, all function define params will align to first param

0 commit comments

Comments
 (0)