voldikss / vim-floaterm

:computer: Terminal manager for (neo)vim
MIT License
2.49k stars 77 forks source link

Deoplete integration is broken. Looks like floaterm.py calls for non-existing function. #225

Closed alexeygumirov closed 3 years ago

alexeygumirov commented 3 years ago

Describe the bug

I am using Deoplete with Floaterm. When I enable Deoplete and start getting auto-completion options, I have the following exception:

[deoplete] Traceback (most recent call last):
  File "/home/alexgum/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 195, in _gather_results
    result = self._get_result(context, source)
  File "/home/alexgum/.local/share/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 255, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/alexgum/.local/share/nvim/plugged/vim-floaterm/rplugin/python3/deoplete/source/floaterm.py", line 29, in gather_candidates
    lines: List[str] = self.vim.call("floaterm#util#getbufline", -1, 100)
  File "/home/alexgum/.local/lib/python3.9/site-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/home/alexgum/.local/lib/python3.9/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/home/alexgum/.local/lib/python3.9/site-packages/pynvim/msgpack_rpc/session.py", line 104, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E117: Unknown function: floaterm#util#getbufline
Error from floaterm: Vim:E117: Unknown function: floaterm#util#getbufline.  Use :messages / see above for error details.
[deoplete] Too many errors from "floaterm". This source is disabled until Neovim is restarted.

It looks like floaterm.py in the Python code for Deoplete calls non-existing function floaterm#util#getbufline. I re-installed floaterm and then I just checked the source code here in repo. I got the same exception.

To Reproduce

call plug#end() color PaperColor set termguicolors let g:airline_theme='papercolor' syntax on set autoindent set nocompatible set inccommand=split set encoding=utf-8 set path+=** set shell=/usr/bin/bash set number relativenumber set showcmd filetype indent on filetype plugin on set wildmenu set showmatch set incsearch set hlsearch set ignorecase set smartcase set cursorline set hidden let mapleader = " " set splitbelow splitright

let g:deoplete#enable_at_startup = 0 autocmd Filetype python call deoplete#enable() autocmd Filetype markdown call deoplete#enable() autocmd Filetype javascript call deoplete#enable() autocmd Filetype sh call deoplete#enable() autocmd Filetype go call deoplete#enable()

command! LF FloatermNew lf let g:floaterm_height = 0.9 let g:floaterm_width = 0.9 let g:floaterm_rootmarkers = ['.git', '.gitignore'] hi Floaterm guibg=black let g:lf_replace_netrw = 1 let g:lf_map_keys = 0 nmap o :LF


- Steps to reproduce the behavior:
  1. Open file for editing
  2. Enable deoplete
  3. Start typing in e.g. path to call deoplete: /usr/bin/ and so on.
  4. When Deoplete window pops up, start deleting with Backspace.
  5. Then exception from above pops up.

### Enviroment
 - OS: Manjaro
 - Version: NVIM v0.5.0-dev+1007-g9223d1450. But I also tried latest stable 0.4.4 and the same error appears.
 - Checkhealth info [run `:checkhealth` and post the messages]:

```txt
health#deoplete#check
========================================================================
## deoplete.nvim
  - OK: exists("v:t_list") was successful
  - OK: has("timers") was successful
  - OK: has("python3") was successful
  - OK: Require Python 3.6.1+ was successful
  - OK: Require msgpack 1.0.0+ was successful
  - INFO: If you're still having problems, try the following commands:
    - $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    - $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    - $ nvim
    - $ cat /tmp/log_{PID}
    - and then create an issue on github

health#LanguageClient#check
========================================================================
  - OK: binary found: /home/alexgum/.local/share/nvim/plugged/LanguageClient-neovim/bin/languageclient
  - OK: languageclient 0.1.161
  - OK: Floating window is supported and will be used for hover

health#floaterm#check
========================================================================
  - OK: Terminal feature is OK
  - OK: Floating window feature is OK
  - OK: nvr is OK

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: tmux-256color
  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.9 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.9.1
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - WARNING: `node` and `npm` (or `yarn`) must be in $PATH.
    - ADVICE:
      - Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

Screenshots(Optional, GIF is better)

alexeygumirov commented 3 years ago

I think it is typo in the floaterm.py code. I checked the plugin functions and there is floaterm#util#getbuflines function (with s in the end).

I changed function name locally on my PC in the floaterm.py and error is gone.

Please, fix the typo in the repo.

BR, Alexey

voldikss commented 3 years ago

Thanks for pointing it out. I'll fix it tomorrow as I am on the bed now... Or could it be convenient for you to draft a PR?

alexeygumirov commented 3 years ago

Thanks for pointing it out. I'll fix it tomorrow as I am on the bed now... Or could it be convenient for you to draft a PR?

I made PR.

voldikss commented 3 years ago

Sorry for the late.... Slept last night