@@ -39,6 +39,7 @@ extension_matcher.get_children = function(item, siblings)
3939 and sibling .is_nested ~= true
4040 and item .parent_path == sibling .parent_path
4141 and sibling .exts == ext
42+ and item .base .. " ." .. ext == sibling .name
4243 then
4344 table.insert (matching_files , sibling )
4445 end
@@ -47,20 +48,6 @@ extension_matcher.get_children = function(item, siblings)
4748 return matching_files
4849end
4950
50- extension_matcher .get_parent = function (item )
51- for base_exts , nesting_exts in pairs (extension_matcher .config ) do
52- for _ , exts in ipairs (nesting_exts ) do
53- if item .exts == exts then
54- local parent_id = utils .path_join (item .parent_path , item .base ) .. " ." .. base_exts
55- if Path :new (parent_id ):exists () then
56- return parent_id
57- end
58- end
59- end
60- end
61- return nil
62- end
63-
6451pattern_matcher .get_nesting_callback = function (item )
6552 for _ , rule_config in pairs (pattern_matcher .config ) do
6653 if item .name :match (rule_config [" pattern" ]) then
@@ -96,8 +83,12 @@ pattern_matcher.get_children = function(item, siblings, rule_config)
9683 end
9784 for type , type_functions in pairs (pattern_matcher .pattern_types ) do
9885 for _ , pattern in pairs (rule_config [type ]) do
86+ local item_name = item .name
87+ if rule_config [" ignore_case" ] ~= nil and item .name_lcase ~= nil then
88+ item_name = item .name_lcase
89+ end
9990 local success , replaced_pattern =
100- pcall (string.gsub , item . name , rule_config [" pattern" ], pattern )
91+ pcall (string.gsub , item_name , rule_config [" pattern" ], pattern )
10192 if success then
10293 local glob_or_file = type_functions .get_pattern (replaced_pattern )
10394 for _ , sibling in pairs (siblings ) do
@@ -208,24 +199,6 @@ function M.nest_items(context)
208199 flatten_nesting (context .nesting )
209200end
210201
211- --- Returns `item` nesting parent path if exists
212- --- @return string ?
213- function get_parent (item , siblings )
214- if item .type ~= " file" then
215- return nil
216- end
217- for _ , matcher in pairs (matchers ) do
218- if matcher .enabled then
219- local parent = matcher .get_parent (item , siblings )
220- if parent ~= nil then
221- return parent
222- end
223- end
224- end
225-
226- return nil
227- end
228-
229202function M .get_nesting_callback (item )
230203 for _ , matcher in pairs (matchers ) do
231204 if matcher .enabled then
@@ -251,6 +224,9 @@ function M.setup(config)
251224 value [" files_glob" ] = {}
252225 value [" files_exact" ] = {}
253226 for _ , glob in pairs (value [" files" ]) do
227+ if value [" ignore_case" ] == true then
228+ glob = glob :lower ()
229+ end
254230 local replaced = glob :gsub (" %%%d+" , " " )
255231 if is_glob (replaced ) then
256232 table.insert (value [" files_glob" ], glob )
0 commit comments