Skip to content

Commit 61e79a6

Browse files
committed
chore: udpdated .editorconfig | .stylua.toml
* still undecided regarding the formatter due to recent issues with lua_ls formatter EmmyLuaCodeStyle
1 parent fb03a24 commit 61e79a6

File tree

2 files changed

+91
-95
lines changed

2 files changed

+91
-95
lines changed

.editorconfig

Lines changed: 84 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/lua.template.editorconfig
12
# see https://github.com/CppCXY/EmmyLuaCodeStyle
23
[*.lua]
34
# [basic]
5+
46
# optional space/tab
57
indent_style = space
68
# if indent_style is space, this is valid
@@ -9,135 +11,122 @@ indent_size = 2
911
tab_width = 2
1012
# none/single/double
1113
quote_style = double
12-
# only support number
13-
continuation_indent_size = 4
1414

15-
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
16-
end_of_line = auto
17-
detect_end_of_line = false
15+
continuation_indent = 4
1816

1917
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
2018
# this option decides when to chopdown the code
2119
max_line_length = 100
2220

21+
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
22+
# in neovim the value 'auto' is not a valid option, please use 'unset'
23+
end_of_line = unset
24+
25+
#optional keep/never/always/smart
26+
trailing_table_separator = keep
27+
28+
# keep/remove/remove_table_only/remove_string_only
29+
call_arg_parentheses = keep
30+
31+
detect_end_of_line = false
32+
2333
# this will check text end with new line
2434
insert_final_newline = true
2535

26-
# [function]
36+
# [space]
37+
space_around_table_field_list = true
2738

28-
# function call expression's args will align to first arg
29-
# optional true/false/only_after_more_indention_statement/only_not_exist_cross_row_expression
30-
align_call_args = false
39+
space_before_attribute = true
3140

32-
# if true, all function define params will align to first param
33-
align_function_define_params = true
41+
space_before_function_open_parenthesis = false
3442

35-
remove_expression_list_finish_comma = true
43+
space_before_function_call_open_parenthesis = false
3644

37-
# keep/remove/remove_table_only/remove_string_only/unambiguous_remove_string_only
38-
call_arg_parentheses = keep
45+
space_before_closure_open_parenthesis = false
3946

40-
# [table]
47+
# optional always/only_string/only_table/none
48+
# or true/false
49+
space_before_function_call_single_arg = true
4150

42-
#optional none/comma/semicolon
43-
table_separator_style = none
51+
space_before_open_square_bracket = false
4452

45-
#optional keep/never/always/smart
46-
trailing_table_separator = keep
53+
space_inside_function_call_parentheses = false
54+
55+
space_inside_function_param_list_parentheses = false
4756

48-
# see document for detail
49-
continuous_assign_table_field_align_to_equal_sign = true
57+
space_inside_square_brackets = false
5058

51-
# if true, format like this "local t = { 1, 2, 3 }"
52-
keep_one_space_between_table_and_bracket = true
59+
# like t[#t+1] = 1
60+
space_around_table_append_operator = false
5361

54-
# if indent_style is tab, this option is invalid
55-
align_table_field_to_first_field = false
62+
ignore_spaces_inside_function_call = false
5663

57-
# [statement]
64+
space_before_inline_comment = 1
5865

59-
align_chained_expression_statement = false
66+
# [operator space]
67+
space_around_math_operator = true
6068

61-
# continous line distance
62-
max_continuous_line_distance = 1
69+
space_after_comma = true
6370

64-
# see document for detail
65-
continuous_assign_statement_align_to_equal_sign = true
71+
space_after_comma_in_for_statement = true
6672

67-
# if statement will align like switch case
68-
if_condition_align_with_each_other = false
73+
space_around_concat_operator = true
6974

70-
# if true, continuation_indent_size for local or assign statement is invalid
71-
# however, if the expression list has cross row expression, it will not be aligned to the first expression
72-
local_assign_continuation_align_to_first_expression = false
75+
# [align]
7376

74-
statement_inline_comment_space = 1
77+
align_call_args = false
7578

76-
# [indentation]
79+
align_function_params = true
7780

78-
# if true, the label loses its current indentation
79-
label_no_indent = false
80-
# if true, there will be no indentation in the do statement
81-
do_statement_no_indent = false
82-
# if true, the conditional expression of the if statement will not be a continuation line indent
83-
if_condition_no_continuation_indent = false
81+
align_continuous_inline_comment = true
8482

85-
if_branch_comments_after_block_no_indent = false
83+
align_continuous_assign_statement = true
8684

87-
# [space]
85+
align_continuous_rect_table_field = true
8886

89-
# if true, t[#t+1] will not space wrapper '+'
90-
table_append_expression_no_space = false
87+
align_if_branch = false
9188

92-
long_chain_expression_allow_one_space_after_colon = false
89+
align_array_table = true
9390

94-
remove_empty_header_and_footer_lines_in_function = true
91+
# [indent]
9592

96-
space_before_function_open_parenthesis = false
97-
space_inside_function_call_parentheses = false
98-
space_inside_function_param_list_parentheses = false
99-
space_before_open_square_bracket = false
100-
space_inside_square_brackets = false
93+
never_indent_before_if_condition = false
94+
95+
never_indent_comment_on_if_branch = false
10196

102-
# if true, ormat like this "local t <const> = 1"
103-
keep_one_space_between_namedef_and_attribute = true
97+
# [line space]
10498

105-
# [row_layout]
10699
# The following configuration supports four expressions
107-
# minLine:${n}
108-
# keepLine
109-
# keepLine:${n}
110-
# maxLine:${n}
111-
112-
keep_line_after_if_statement = minLine:0
113-
keep_line_after_do_statement = minLine:0
114-
keep_line_after_while_statement = minLine:0
115-
keep_line_after_repeat_statement = minLine:0
116-
keep_line_after_for_statement = minLine:0
117-
keep_line_after_local_or_assign_statement = keepLine
118-
keep_line_after_function_define_statement = keepLine:1
119-
keep_line_after_expression_statement = keepLine
120-
121-
# [diagnostic]
122-
123-
# the following is code diagnostic options
124-
enable_check_codestyle = true
125-
126-
# [diagnostic.name_style]
127-
enable_name_style_check = true
128-
# the following is name style check rule
129-
# base option off/camel_case/snake_case/upper_snake_case/pascal_case/same(filename/first_param/'<const string>', snake_case/pascal_case/camel_case)
130-
# all option can use '|' represent or
131-
# for example:
132-
# snake_case | upper_snake_case
133-
# same(first_param, snake_case)
134-
# same('m')
135-
local_name_define_style = snake_case
136-
function_param_name_style = snake_case
137-
function_name_define_style = snake_case
138-
local_function_name_define_style = snake_case
139-
table_field_name_define_style = snake_case
140-
global_variable_name_define_style = snake_case|upper_snake_case
141-
module_name_define_style = same('m')|same(filename, snake_case)
142-
require_module_name_style = same(first_param, snake_case)
143-
class_name_define_style = same(filename, snake_case)
100+
# keep
101+
# fixed(n)
102+
# min(n)
103+
# max(n)
104+
# for eg. min(2)
105+
106+
line_space_after_if_statement = keep
107+
108+
line_space_after_do_statement = keep
109+
110+
line_space_after_while_statement = keep
111+
112+
line_space_after_repeat_statement = keep
113+
114+
line_space_after_for_statement = keep
115+
116+
line_space_after_local_or_assign_statement = keep
117+
118+
line_space_after_function_statement = fixed(2)
119+
120+
line_space_after_expression_statement = keep
121+
122+
line_space_after_comment = keep
123+
124+
# [line break]
125+
break_all_list_when_line_exceed = false
126+
127+
auto_collapse_lines = false
128+
129+
# [preference]
130+
ignore_space_after_colon = false
131+
132+
remove_call_expression_list_finish_comma = false

.stylua.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
column_width = 100
2+
line_endings = "Unix"
3+
indent_type = "Spaces"
4+
indent_width = 2
5+
quote_style = "AutoPreferDouble"
6+
call_parentheses = "Always"
7+
collapse_simple_statement = "Never"

0 commit comments

Comments
 (0)