forked from CppCXY/EmmyLuaCodeStyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuaCodeStyleOptions.cpp
More file actions
43 lines (40 loc) · 1.76 KB
/
LuaCodeStyleOptions.cpp
File metadata and controls
43 lines (40 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "CodeService/LuaCodeStyleOptions.h"
#include "CodeService/FormatElement/MinLineElement.h"
#include "CodeService/FormatElement/KeepLineElement.h"
#include "CodeService/NameStyle/NameStyleRuleMatcher.h"
std::string GetIndentStyleName(IndentStyle style)
{
switch (style)
{
case IndentStyle::Tab:
{
return "tab";
}
case IndentStyle::Space:
{
return "space";
}
}
return "unknown";
}
LuaCodeStyleOptions::LuaCodeStyleOptions()
:
keep_line_after_if_statement(std::make_shared<MinLineElement>(0)),
keep_line_after_do_statement(std::make_shared<MinLineElement>(0)),
keep_line_after_while_statement(std::make_shared<MinLineElement>(0)),
keep_line_after_repeat_statement(std::make_shared<MinLineElement>(0)),
keep_line_after_for_statement(std::make_shared<MinLineElement>(0)),
keep_line_after_local_or_assign_statement(std::make_shared<KeepLineElement>()),
keep_line_after_function_define_statement(std::make_shared<KeepLineElement>(1)),
keep_line_after_expression_statement(std::make_shared<KeepLineElement>()),
local_name_define_style(std::make_shared<NameStyleRuleMatcher>("Local")),
function_param_name_style(std::make_shared<NameStyleRuleMatcher>("Parameters")),
function_name_define_style(std::make_shared<NameStyleRuleMatcher>("Class and module method")),
local_function_name_define_style(std::make_shared<NameStyleRuleMatcher>("Local method")),
table_field_name_define_style(std::make_shared<NameStyleRuleMatcher>("Table field")),
global_variable_name_define_style(std::make_shared<NameStyleRuleMatcher>("Global")),
module_name_define_style(std::make_shared<NameStyleRuleMatcher>("Module")),
require_module_name_style(std::make_shared<NameStyleRuleMatcher>("Require module")),
class_name_define_style(std::make_shared<NameStyleRuleMatcher>("Class"))
{
}