File tree Expand file tree Collapse file tree 2 files changed +44
-4
lines changed
Expand file tree Collapse file tree 2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ bool TextElement::SnakeCase()
152152 {
153153 lowerCase = false ;
154154 }
155- else if (ch == ' _' && _text.size () == 1 )
155+ else if (ch == ' _' && _text.size () == 1 )
156156 {
157157 return true ;
158158 }
@@ -163,7 +163,6 @@ bool TextElement::SnakeCase()
163163 }
164164 else if ((lowerCase && !::islower (ch)) || (!lowerCase && !::isupper (ch)))
165165 {
166-
167166 if (ch == ' _' )
168167 {
169168 // 不允许双下划线
@@ -172,7 +171,7 @@ bool TextElement::SnakeCase()
172171 return false ;
173172 }
174173 }
175- else if (!::isdigit (ch))
174+ else if (!::isdigit (ch))
176175 {
177176 return false ;
178177 }
@@ -203,7 +202,7 @@ bool TextElement::PascalCase()
203202 }
204203 }
205204 }
206- // 我又没办法分词简单处理下
205+ // 我又没办法分词简单处理下
207206 else if (!::isalnum (ch))
208207 {
209208 return false ;
Original file line number Diff line number Diff line change @@ -128,6 +128,47 @@ std::shared_ptr<LuaCodeStyleOptions> LuaCodeStyleOptions::ParseFromEditorConfig(
128128 }
129129 }
130130 }
131+
132+ if (editorConfig->Exist (" insert_final_newline" ))
133+ {
134+ options->insert_final_newline = editorConfig->Get (" insert_final_newline" ) == " true" ;
135+ }
136+
137+ if (editorConfig->Exist (" enable_name_style_check" ))
138+ {
139+ options->enable_name_style_check = editorConfig->Get (" enable_name_style_check" ) == " true" ;
140+ }
141+
142+ std::vector<std::pair<std::string, NameStyle&>> styleList = {
143+ {" local_name_define_style" , options->local_name_define_style },
144+ {" function_name_define_style" , options->function_name_define_style },
145+ {" table_field_name_define_style" , options->table_field_name_define_style },
146+ };
147+
148+ for (auto & styleOption : styleList)
149+ {
150+ if (editorConfig->Exist (styleOption.first ))
151+ {
152+ std::string value = editorConfig->Get (styleOption.first );
153+ if (value == " off" )
154+ {
155+ styleOption.second = NameStyle::Off;
156+ }
157+ else if (value == " snake_case" )
158+ {
159+ styleOption.second = NameStyle::SnakeCase;
160+ }
161+ else if (value == " camel_case" )
162+ {
163+ styleOption.second = NameStyle::CamelCase;
164+ }
165+ else if (value == " pascal_case" )
166+ {
167+ styleOption.second = NameStyle::PascalCase;
168+ }
169+ }
170+ }
171+
131172 return options;
132173}
133174
You can’t perform that action at this time.
0 commit comments