File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,12 @@ void LuaEditorConfig::ParseFromSection(std::shared_ptr<LuaCodeStyleOptions> opti
243243 options->continuation_indent_size = std::stoi (configMap.at (" continuation_indent_size" ));
244244 }
245245
246+ if (configMap.count (" statement_inline_comment_space" )
247+ && isNumber (configMap.at (" statement_inline_comment_space" )))
248+ {
249+ options->statement_inline_comment_space = std::stoi (configMap.at (" statement_inline_comment_space" ));
250+ }
251+
246252 if (configMap.count (" local_assign_continuation_align_to_first_expression" ))
247253 {
248254 options->local_assign_continuation_align_to_first_expression =
Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatBlock(std::shared_ptr<LuaAstN
331331 {
332332 if (!last->GetChildren ().empty () && last->GetChildren ().back ()->HasValidTextRange ())
333333 {
334- last->Add <KeepBlankElement>(1 );
334+ last->Add <KeepBlankElement>(_options. statement_inline_comment_space );
335335 }
336336 last->AddChild (FormatComment (statement));
337337 }
@@ -359,7 +359,7 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatBlock(std::shared_ptr<LuaAstN
359359
360360 if (currentLine == nextLine)
361361 {
362- statEnv->Add <KeepBlankElement>(1 );
362+ statEnv->Add <KeepBlankElement>(_options. statement_inline_comment_space );
363363 statEnv->Add <TextElement>(next);
364364 ++it;
365365 }
@@ -1676,7 +1676,7 @@ std::shared_ptr<FormatElement> LuaFormatter::FormatAlignStatement(LuaAstNode::Ch
16761676 auto lastStatementEnv = env->LastValidElement ();
16771677 if (lastStatementEnv)
16781678 {
1679- lastStatementEnv->Add <KeepBlankElement>(1 );
1679+ lastStatementEnv->Add <KeepBlankElement>(_options. statement_inline_comment_space );
16801680 lastStatementEnv->AddChild (FormatNode (nextChild));
16811681 }
16821682 // else 应该不存在这种情况
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class LuaCodeStyleOptions
4040 */
4141 int continuation_indent_size = 4 ;
4242
43+ int statement_inline_comment_space = 1 ;
4344
4445 bool local_assign_continuation_align_to_first_expression = false ;
4546
You can’t perform that action at this time.
0 commit comments