deoplete-plugins / deoplete-clang

deoplete.nvim source for C/C++/Obj-C/Obj-C++ with clang-python3
MIT License
189 stars 73 forks source link

deoplete-clang can't deal with files open with Netrw #69

Open glacambre opened 7 years ago

glacambre commented 7 years ago

Problems summary

I recently tried to open a file over the scp:// protocol which is handled by Vim's "Netrw" plugin. When trying to autocomplete a word, the message

[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     params)
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 314, in get_completion
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete] Traceback (most recent call last):
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 302, in get_translation_unit
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete]     tu.save(ast_file)
[deoplete]     ctx['candidates'] = source.gather_candidates(ctx)
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/clang/clang/cindex.py", line 2638, in save
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 151, in gather_candidates
[deoplete]     'Error saving TranslationUnit.')
[deoplete]     params)
[deoplete] clang.cindex.TranslationUnitSaveError: Error 1: Error saving TranslationUnit.
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 314, in get_completion
[deoplete] Could not get completions from: clang.  Use :messages for error details.
[deoplete]     tu = self.get_translation_unit(fname, args, buf)
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/sources/deoplete_clang.py", line 302, in get_translation_unit
[deoplete]     tu.save(ast_file)
[deoplete]   File "/home/me/.vim/bundle/repos/github.com/zchee/deoplete-clang/rplugin/python3/deoplete/clang/clang/cindex.py", line 2638, in save
[deoplete]     'Error saving TranslationUnit.')
[deoplete] clang.cindex.TranslationUnitSaveError: Error 1: Error saving TranslationUnit.
[deoplete] Could not get completions from: clang.  Use :messages for error details.

is shown.

Expected

No error message and the autocompletion popup is filled as it would be with a local file.

Environment Information

Provide a minimal init.vim with less than 50 lines and not plugin manager (Required!)

set runtimepath+=/tmp/deoplete.nvim/
set runtimepath+=~/tmp/deoplete-clang/
let g:deoplete#enable_at_startup = 1

The reproduce ways from neovim starting (Required!)

  1. run nvim -u /tmp/vimrc scp://server/tmp/tmp.c
  2. Press a (in order to go into insert mode)
  3. press "int". Once the 't' is pressed, the error messages will be shown.

Upload the log file

Since the log file is very large I uploaded it here: https://gist.github.com/glacambre/bb959fd61acd3385c95e8aa4b5e134d9 There's nothing interesting in my .nvimlog.

I think this is a bug with deoplete-clang because other autocompletion plugins (deoplete-jedi for example) do not have this bug.

Shougo commented 7 years ago

The file in the remote server is not supported. And it is hard to test.

glacambre commented 7 years ago

Alright, thanks. Do you know what the difference between deoplete-clang and deoplete-jedi is? Could the way deoplete-jedi works be implemented in deoplete-clang? (I'm willing to try to do it if you think it is)

zchee commented 7 years ago

@glacambre Thanks for issue. But sorry, Now I don't know why the only jedi haven't problem.

However,

Alright, thanks. Do you know what the difference between deoplete-clang and deoplete-jedi is? Could the way deoplete-jedi works be implemented in deoplete-clang? (I'm willing to try to do it if you think it is)

Note that now deoplete-clang will be planned dynamically change using zchee/clang-server backend.(now development). So, If you try to solve this problem(very thanks), only for deoplete-go is better.

Because all of the implementation will change, such as not using the libclang-python3 module, msgpack-rpc(or google/grpc) server/client architecture and deoplete-clang will client side only, or etc.

Shougo commented 6 years ago

Note that now deoplete-clang will be planned dynamically change using zchee/clang-server backend.(now development). So, If you try to solve this problem(very thanks), only for deoplete-go is better.

Progress?

I work for deoplete parallel feature.