Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.14k stars 180 forks source link

`UnboundLocalError: cannot access local variable 'filename' where it is not associated with a value` #1051

Closed jameswillett closed 7 months ago

jameswillett commented 7 months ago

let g:Lf_WindowPosition = 'popup' let g:Lf_PreviewInPopup = 1 let g:Lf_CommandMap = {'': [], '': [''], '': [], '': ['']}

### Describe your question, feature request, or bug.

after updating today i have run into this error. this error only occurs currently on `master`; checking out to `v1.24` i do not have this issue
![Peek 2024-01-18 13-37](https://github.com/Yggdroot/LeaderF/assets/30274748/4d1836bb-c3be-4a6e-b699-16503b6b7d60)

Error detected while processing function leaderf#Any#start[4]..leaderf#LfPy[1]..provider#python3#Call: line 18: Error invoking 'python_execute' on channel 6 (python3-script-host): Traceback (most recent call last): File "", line 1, in File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/anyExpl.py", line 821, in start the_args.start(arguments, *args, kwargs) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/anyExpl.py", line 753, in _default_action manager.startExplorer(win_pos[2:], *args, *kwargs) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/fileExpl.py", line 827, in startExplorer super(FileExplManager, self).startExplorer(win_pos, args, kwargs) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 2805, in startExplorer self.input() File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 62, in deco func(self, *args, kwargs) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 3035, in input self._search(cur_content) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 1542, in _search self._previewResult(False) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 438, in _previewResult self._previewInPopup(line, self._getInstance().buffer, line_num) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/devicons.py", line 417, in deco return func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/fileExpl.py", line 845, in _previewInPopup self._createPopupPreview(line, source, 0) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/utils.py", line 1419, in deco return func(self, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 940, in _createPopupPreview self._useExistingWindow(title, source, line_num, jump_cmd) File "/home/james/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/manager.py", line 910, in _useExistingWindow cur_filetype = getExtension(filename) ^^^^^^^^ UnboundLocalError: cannot access local variable 'filename' where it is not associated with a value


### Steps to reproduce
error occurs when trying to search for any non-empty file after typing a single keystroke. i am unable to add any more letters to the search query after that initial keystroke but i AM able to use the arrows to navigate the file list (after clearing the error each time). using `<C-j>` and `<C-k>` no longer works
### Actual behaviour

error above

### Expected behaviour

able to search for files
Yggdroot commented 7 months ago

Fixed.