laloch / xontrib-fzf-widgets

Set of fzf widgets for xonsh
GNU General Public License v3.0
33 stars 18 forks source link

Incompatible signature of `complete_path` -> `_complete_path_raw` #25

Open doronz88 opened 4 months ago

doronz88 commented 4 months ago

In recent xonsh versions, complete_path now receives a context. In order to preserve the same functionality, a refactor of using _complete_path_raw instead if now necessary.

Till then, This causes the following bug to occur:

# Hitting Ctrl+T while in the following line
ls L<Ctrl+T>

Triggers the following exception:

Unhandled exception in event loop:
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/input/vt100.py", line 162, in callback_wrapper
    callback()
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 712, in read_from_input_in_context
    context.copy().run(read_from_input)
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 692, in read_from_input
    self.key_processor.process_keys()
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/key_binding/key_processor.py", line 187, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/key_binding/key_processor.py", line 322, in _call_handler
    handler.call(event)
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 124, in call
    result = self.handler(event)
             ^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/xontrib/fzf-widgets.xsh", line 138, in fzf_file
    fzf_insert_file(event)

  File "/Users/user/Library/Application Support/pipx/venvs/xonsh/lib/python3.11/site-packages/xontrib/fzf-widgets.xsh", line 66, in fzf_insert_file
    paths = complete_path(os.path.normpath(prefix), before_cursor, 0, len(before_cursor), None)[0]

Exception complete_path() takes 1 positional argument but 5 were given
Press ENTER to continue...