|
1 | 1 | #include "CodeService/LuaCodeStyleOptions.h" |
2 | 2 | #include <filesystem> |
3 | | -#include <regex> |
4 | 3 | #include "CodeService/FormatElement/MinLineElement.h" |
5 | 4 | #include "CodeService/FormatElement/KeepLineElement.h" |
| 5 | +#include "CodeService/NameStyle/NameStyleRuleMatcher.h" |
6 | 6 |
|
7 | 7 | LuaCodeStyleOptions::LuaCodeStyleOptions() |
8 | 8 | : |
9 | | - keep_line_after_if_statement(std::make_shared<MinLineElement>(1)), |
10 | | - keep_line_after_do_statement(std::make_shared<MinLineElement>(1)), |
11 | | - keep_line_after_while_statement(std::make_shared<MinLineElement>(1)), |
12 | | - keep_line_after_repeat_statement(std::make_shared<MinLineElement>(1)), |
13 | | - keep_line_after_for_statement(std::make_shared<MinLineElement>(1)), |
14 | | - keep_line_after_local_or_assign_statement(std::make_shared<KeepLineElement>()), |
15 | | - keep_line_after_function_define_statement(std::make_shared<KeepLineElement>(1)) |
| 9 | + keep_line_after_if_statement(nullptr), |
| 10 | + keep_line_after_do_statement(nullptr), |
| 11 | + keep_line_after_while_statement(nullptr), |
| 12 | + keep_line_after_repeat_statement(nullptr), |
| 13 | + keep_line_after_for_statement(nullptr), |
| 14 | + keep_line_after_local_or_assign_statement(nullptr), |
| 15 | + keep_line_after_function_define_statement(nullptr), |
| 16 | + |
| 17 | + local_name_define_style(nullptr), |
| 18 | + function_name_define_style(nullptr), |
| 19 | + table_field_name_define_style(nullptr), |
| 20 | + global_variable_name_define_style(nullptr), |
| 21 | + module_name_define_style(nullptr), |
| 22 | + require_module_name_style(nullptr), |
| 23 | + class_name_define_style(nullptr) |
16 | 24 | { |
| 25 | + SetDefault(); |
| 26 | +} |
| 27 | + |
| 28 | +void LuaCodeStyleOptions::SetDefault() |
| 29 | +{ |
| 30 | + keep_line_after_if_statement = std::make_shared<MinLineElement>(1); |
| 31 | + keep_line_after_do_statement = std::make_shared<MinLineElement>(1); |
| 32 | + keep_line_after_while_statement = std::make_shared<MinLineElement>(1); |
| 33 | + keep_line_after_repeat_statement = std::make_shared<MinLineElement>(1); |
| 34 | + keep_line_after_for_statement = std::make_shared<MinLineElement>(1); |
| 35 | + keep_line_after_local_or_assign_statement = std::make_shared<KeepLineElement>(); |
| 36 | + keep_line_after_function_define_statement = std::make_shared<KeepLineElement>(1); |
| 37 | + |
| 38 | + local_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
| 39 | + function_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
| 40 | + table_field_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
| 41 | + global_variable_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
| 42 | + module_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
| 43 | + require_module_name_style = std::make_shared<NameStyleRuleMatcher>(); |
| 44 | + class_name_define_style = std::make_shared<NameStyleRuleMatcher>(); |
17 | 45 | } |
0 commit comments