Skip to content

Commit 8245f2a

Browse files
committed
Exclude directory in search files for performance
1 parent 75c1ee2 commit 8245f2a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

autoload/project/search_files.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ function! s:GetSearchFilesByFilterForDirectory(input)
294294
return list
295295
endfunction
296296

297-
function! s:GetSearchFilesByFilterForFullpath(input)
297+
function! s:GetSearchFilesByFilterForAll(input, include_dir = 0)
298298
let filter_origin = a:input
299299
let list = []
300300
" Match file
@@ -315,6 +315,10 @@ function! s:GetSearchFilesByFilterForFullpath(input)
315315
let list += list_extra
316316
endif
317317

318+
if !a:include_dir
319+
return list
320+
endif
321+
318322
" Match path and file if list is short
319323
if len(list) < s:GetMaxHeight()
320324
let list_extra = filter(copy(s:initial_list), {_, val -> val.path.val.file =~ filter_origin})
@@ -334,8 +338,8 @@ function! s:GetSearchFilesByFilter(input)
334338
" Match directory only
335339
return s:GetSearchFilesByFilterForDirectory(a:input)
336340
else
337-
" Match both directory and filename
338-
return s:GetSearchFilesByFilterForFullpath(a:input)
341+
" Match filename, directory excluded by default for performance
342+
return s:GetSearchFilesByFilterForAll(a:input)
339343
endif
340344
endfunction
341345

0 commit comments

Comments
 (0)