uplus / deoplete-solargraph

deoplete.nvim source for Ruby with solargraph.
MIT License
74 stars 6 forks source link

Errors opening Vim even when using version 0.18.0 #8

Open jondkinney opened 6 years ago

jondkinney commented 6 years ago

Thanks for this! I'm a little confused how to get the default implementation working. Any help would be greatly appreciated!

https://github.com/uplus/deoplete-solargraph/issues/5 mentioned to use version 0.18.0 and until I did that opening vim didn't do anything. Now when I open Vim I get the following error.

[deoplete] Traceback (most recent call last):^@  File "/Users/jon/.vim/plugged/deoplete.nvim/rplugin/python3/deoplete/child.py", line 101, in _add_source^@    Source = import_plugin(path, 'source', 'Source')^@  File "/Users/jon/.vim/plugged/deoplete.nvim/rplugin/pytho
n3/deoplete/util.py", line 67, in import_plugin^@    module = SourceFileLoader(module_name, path).load_module()^@  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper^@  File "<frozen importlib._bootstrap_external>", line 823, in load_modul
e^@  File "<frozen importlib._bootstrap_external>", line 682, in load_module^@  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim^@  File "<frozen importlib._bootstrap>", line 684, in _load^@  File "<frozen importlib._bootstrap>", line 665, in _load
_unlocked^@  File "<frozen importlib._bootstrap_external>", line 678, in exec_module^@  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed^@  File "/Users/jon/.vim/plugged/deoplete-solargraph/rplugin/python3/deoplete/source/solargraph.py", li
ne 7, in <module>^@    import solargraph_utils as solar^@ModuleNotFoundError: No module named 'solargraph_utils'^@Could not load source: /Users/jon/.vim/plugged/deoplete-solargraph/rplugin/python3/deoplete/source/solargraph.py.  Use :messages / see above for error det
ails.

I have the solargraph-utils.py installed per the README. I'm not exactly sure what to do next to keep troubleshooting.

/Users/jon/.vim/plugged/deoplete-solargraph/rplugin/python3/deoplete/source/solargraph.py is present.

Here's my Vim info:

± vim --version                                                                                                                                                                                                                           rvm:(ruby-2.5.1@thirdelementweb)
VIM - Vi IMproved 8.1 (2018 May 17, compiled May 22 2018 22:51:49)
macOS version
Included patches: 1
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           -python            +vreplace
+conceal           +linebreak         +python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework AppKit   -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.5.1 -lobjc
iovis commented 6 years ago

Does :UpdateRemotePlugins solve anything?

halftan commented 6 years ago

I'll try to make these issues independent from each other, so please post anything related to this problem here.

@jondkinney Have you installed solargraph_utils by running pip install solargraph-utils.py --user ?

jondkinney commented 6 years ago

Thanks for the hints @iovis9 and @halftan. I did already run the solargraph-utils install through pip. Should something from that install be accessible on my path for me to test that things are working? I do have the solargraph gem properly installed and can get help from it at the command line.

:UpdateRemotePlugins doesn't fix it, per se. Though it did appear to update successfully. By the way, I was initially trying with Vim 8.1 with python3 and +timers (which works with deoplete itself, but maybe not this plugin?). I've since installed nvim and am having the same / similar issue there:

image

Thanks for the help!

halftan commented 6 years ago

If you have both python2 and python3 installed, make sure to install solargraph-utils.py using pip3 otherwise the neovim python client won't find it.

The python package install location is dependent to your environment. If you've installed your python3 from pyenv or something similar, give ~/.pyenv/versions a peek.

jondkinney commented 6 years ago

@halftan a ha! I had to do pip3 install solargraph-utils.py --user. Thanks for that. The error is gone in both Vim 8.1 and neovim now. 👍

So now if I have a Rails app with a users_controller.rb and I have:

@user = User.find(params[:id])
@user.

When typing @user. above, it opens deoplete suggestions for methods on user in the current file (though they don't say [solar] next to them, they say [F]), should solargraph be able to introspect the user model and give me instance methods in the deoplete dropdown?

I realize this might be a bit of a different question/issue, but I'm still trying to figure out if it's installed properly and what to expect when it's working, so seemed like an ok thing to ask here in this issue for others following along.

Thanks again!

halftan commented 6 years ago

@jondkinney If you see [F] or [M] next to the candidates, that's neovim doing the completion. (The omnifunc,) You need to tell deoplete.nvim to use solar as a source in ruby files. Please refer to deoplete on how to configure sources for specific filetypes.

Or, maybe you have deoplete configured to use omni source in ruby files. Either way, your deoplete configuration needs to be looked into.

jondkinney commented 6 years ago

@halftan do you have a working ruby setup I can reference? Here's what I have so far related to deoplete and js and ruby. It's hard to find docs to patch this all together across different languages.

" Use deoplete (autocomplete) on startup
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1

" deoplete.nvim
" inoremap <silent> <expr> <Tab> pumvisible() ? '\<C-n>' : deoplete#mappings#manual_complete()

" deoplete-ternjs
let g:deoplete#sources = {}
let g:deoplete#sources.javascript = ['ternjs']
let g:deoplete#sources.gitcommit = ['github']
" let g:deoplete#sources.ruby = ['solar'] " do I want this?

let g:deoplete#omni#functions = {}
let g:deoplete#omni_patterns = {}

" tern_for_vim
let g:tern#command = ['tern']
let g:tern#arguments = ['--persistent']
let g:deoplete#omni#functions.javascript = ['tern#Complete']
let g:deoplete#omni_patterns.javascript = '\h\w*\|\h\w*\.\%(\h\w*\)\|[^. \t]\.\%(\h\w*\)'

" ruby
let g:deoplete#omni#functions.ruby = ['solar']
let g:deoplete#omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'

"Add extra filetypes
let g:deoplete#sources#ternjs#filetypes = [
                \ 'jsx',
                \ 'javascript.jsx',
                \ 'vue',
                \ ]
halftan commented 6 years ago

@jondkinney you don't want these two lines

let g:deoplete#omni#functions.ruby = ['solar']
let g:deoplete#omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'

they're for omnifunctions.

And the source's name is solargraph, not solar. See here

If you're still in doubt, please be free to check out my vimrc with caveat:

let g:deoplete#sources.ruby = ['tag', 'omni', 'buffer', 'file', 'ultisnips']
let g:deoplete#sources.eruby = ['tag', 'omni', 'buffer', 'file', 'ultisnips']

change to:

let g:deoplete#sources.ruby = ['tag', 'solargraph', 'buffer', 'file', 'ultisnips']
let g:deoplete#sources.eruby = ['tag', 'solargraph', 'buffer', 'file', 'ultisnips']