far.vim icon indicating copy to clipboard operation
far.vim copied to clipboard

Setting ignore_files results in errors when searching

Open oxysoft opened this issue 5 years ago • 2 comments

If I add simply this to my config:

let g:far#ignore_files = [ '.meta' ]

It results in the following when I try searching

Error detected while processing function Find[22]..far#find[43]..<SNR>197_assemble_context[55]..far#executors#py3#execute[8]..far#rpc#invoke[9]..provider#python3#Call:                                                                       
line   18:                                                                                                                                                                                                                                    
Error invoking 'python_eval' on channel 8 (python3-script-host):                                                                                                                                                                              
error caught in request handler 'python_eval ['far_rpc_invoker()']':                                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/usr/lib/python3/dist-packages/pynvim/plugin/script_host.py", line 169, in python_eval                                                                                                                                                
    return eval(expr, self.module.__dict__)                                                                                                                                                                                                   
  File "<string>", line 1, in <module>                                                                                                                                                                                                        
  File "<string>", line 3, in far_rpc_invoker                                                                                                                                                                                                 
  File "/home/nuck/vimfiles/plugged/far.vim/rplugin/python3/far/sources/shell.py", line 46, in search                                                                                                                                         
    logger.debug(f'Globbing with ripgrep: rg --files {rg_rules_glob(rules)} {rg_ignore_globs(ignore_files)}')                                                                                                                                 
  File "/home/nuck/vimfiles/plugged/far.vim/rplugin/python3/far/sources/far_glob.py", line 133, in rg_ignore_globs                                                                                                                            
    ignored = {val for sublist in [open(file, 'r').read().split('\n') for file in files] for val in sublist if len(val.strip()) > 0 and ("#" not in val)}                                                                                     
  File "/home/nuck/vimfiles/plugged/far.vim/rplugin/python3/far/sources/far_glob.py", line 133, in <listcomp>                                                                                                                                 
    ignored = {val for sublist in [open(file, 'r').read().split('\n') for file in files] for val in sublist if len(val.strip()) > 0 and ("#" not in val)}                                                                                     
FileNotFoundError: [Errno 2] No such file or directory: '.meta'   

Any ideas? I am up-to-date with master.

Perhaps this can help as well:

➜ rg --version
ripgrep 11.0.2
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

oxysoft avatar Dec 18 '20 13:12 oxysoft

Possibly related: it seems globbing may be using regex, because I have to escape several characters in globs for regular commands e.g.

:F ance_ \*\.lua

Otherwise, the globbing doesn't seem to work as expected (i.e. isn't matching files that should match)

oxysoft avatar Dec 18 '20 14:12 oxysoft

I've experienced the first issue you mentioned, this seems to be related to PR #98 which is now using ripgrep to glob the files but does not filter out non-existing ignore files. I'll post a PR to fix this issue. Regarding the second issue, I'm not sure it's related, I couldn't reproduce it here, maybe consider opening a separate issue and add more details.

benshu avatar Dec 24 '20 20:12 benshu