deoplete-ternjs
deoplete-ternjs copied to clipboard
deoplete-ternjs can't deal with files open with Netrw
When trying to autocomplete the content of a file open over the scp:// protocol, deoplete-ternjs will display errors and won't fill the autocompletion popup menu. Here are the steps to reproduce the bug, provided that deoplete and deoplete-ternjs are loaded in your vimrc:
nvim scp://server//tmp/tmp.js
:set ft=javascript
a (go into insert mode)
let
Once you do that, the following errors will be shown:
[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/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] result = self.completation(pos) or []
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 180, in run_command
[deoplete] self.start_server()
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 92, in start_server
[deoplete] portFile = os.path.join(self._project_directory, ".tern-port")
[deoplete] Traceback (most recent call last):
[deoplete] File "/usr/lib64/python3.4/posixpath.py", line 82, in join
[deoplete] File "/home/me/.vim/bundle/repos/github.com/Shougo/deoplete.nvim/rplugin/python3/deoplete/deoplete.py", line 100, in gather_results
[deoplete] path += b
[deoplete] ctx['candidates'] = source.gather_candidates(ctx)
[deoplete] TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 351, in gather_candidates
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
[deoplete] result = self.completation(pos) or []
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 307, in completation
[deoplete] data = self.run_command(command, pos)
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 198, in run_command
[deoplete] doc["files"].append(self.full_buffer())
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 236, in full_buffer
[deoplete] "name": self.relative_file(),
[deoplete] File "/home/me/.vim/bundle/repos/github.com/carlitux/deoplete-ternjs/rplugin/python3/deoplete/sources/ternjs.py", line 251, in relative_file
[deoplete] return filename[len(self._project_directory) + 1:]
[deoplete] TypeError: object of type 'NoneType' has no len()
[deoplete] Could not get completions from: ternjs. Use :messages for error details.
I believe this is a bug with deoplete-ternjs and not a deoplete one because other autocompletion plugins (such as deoplete-jedi) work over scp.
I didn't tested over it and I don't have time to do it. If you can look at it and do a pull request would be good.
I found a way to prevent the errors from popping up but haven't found a way to actually have autocompletion work. I opened an issue on another deoplete plugin because a similar bug was happening (https://github.com/zchee/deoplete-clang/issues/69) and deoplete's maintainer said opening remote files wasn't supported. I asked him for more information and will continue working on this issue once he gives me an answer.