gelguy / wilder.nvim

A more adventurous wildmenu
MIT License
1.36k stars 34 forks source link

File finder: customizable behavior on should_use_file_finder #185

Open wookayin opened 1 year ago

wookayin commented 1 year ago

The file finder is not used in some conditions, as in wilder#cmdline#should_use_file_finder including:

  " cmdline
  " : check getcmdtype()?
  " |--> return v:false
  " : parse_cmdline
  " : prepare user completion to update res.expand
  " : if handled
  " |--> return v:false
  " : check is file or dir
  " |--> return v:false
  " : prepare_file_completion
  " | reset parsed.pos to original
+ " : should use file finder?
+ " |--> return v:false
  " : debounce if needed
  " : _wilder_python_file_finder
  " : add pos, replace and data
  " └--> result

but I would still like to use the file finder even when file path starts with some absolute path. I know this is added to prevent scanning of large filesystem accidentally, but I feel it's too limiting. Due to the should_use_file_finder checker returning false, the file_command handler is never called. Would it be possible to add some opts to bypass this (at users' own risk)?

My current config:

let l:pipeline = 
        \ wilder#python_file_finder_pipeline({
        \   'debounce': 50,
        \   'file_command': {ctx, arg -> v:lua._wilder_fuzzy_fd_pipeline_command(ctx, arg, 'f')},
        \   'dir_command':  {ctx, arg -> v:lua._wilder_fuzzy_fd_pipeline_command(ctx, arg, 'd')},
        \   'filters': ['fuzzy_filter', 'difflib_sorter'],
        \   'path': {-> getcwd()},
        \ }) : l:pipeline.noop

where _wilder_fuzzy_fd_pipeline_command is my custom fd command generator.

wookayin commented 1 year ago

@gelguy Any advices?