LanguageClient-neovim
LanguageClient-neovim copied to clipboard
LanguageClient not delivering payload off reference (i.e. variable) objects in Ruby using solargraph
-
Did you upgrade to latest plugin version? Yes
-
Did you upgrade to/compile latest binary? Run shell command
bin/languageclient --version
to get its version number.languageclient 0.1.132 cffa8b55eb93d33bc00795c8c85ea7dc6912f21f
-
(Neovim users only) Did you check output of
:checkhealth LanguageClient
?
health#LanguageClient#check
========================================================================
- OK: binary found: /Users/nathan/.config/nvim/plugged/LanguageClient-neovim/bin/languageclient
- OK: languageclient 0.1.132 cffa8b55eb93d33bc00795c8c85ea7dc6912f21f
- Did you check [troubleshooting]? Yes
Describe the bug
I am using LanguageClient with YouCompleteMe (YCM) for Ruby using with solargraph and I'm observing the following issue:
This works:
[]. # <-- The menu properly appears and methods served by the language server are presented
This does not work:
a = []
a. # <-- Menu does not appear, and if it does, it does not contain any methods from the language server
Additional steps taken
I have troubleshooted this with the help of a YCM contributor based on a unrelated issue I discovered: https://github.com/Valloric/YouCompleteMe/issues/3274
Here is what I got:
a = []
a.
Placing my curser after the .
I got the following from the commands:
:echo LanguageClient#complete(1, "") #=> 2
:echo LanguageClient#complete(0, "") #=> []
In contrast, with...
[].
I get:
:echo LanguageClient#complete(1, "") #=> 3
:echo LanguageClient#complete(0, "") #=>
[{'info': '', 'menu': '=> Boolean', 'user_data': '{"lspitem":{"label":"any?","kind":2,"detail":"=> Boolean","sortText":"0000any?","textEdit":{"range":{"start":{"line":0,"characte
r":3},"end":{"line":0,"character":3}},"newText":"any?"},"data":{"deprecated":false,"location":null,"path":"Array#any?","return_type":"Boolean"}}}', 'word': 'any?', 'kind': 'Metho
d', 'abbr': 'any?', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(key) => Array, nil', 'user_data': '{"lspitem":{"label":"assoc","kind":2,"detail":"(key) => Array, nil","sortText
":"0000assoc","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"assoc"},"data":{"deprecated":false,"location":null,"path":"Array#as
soc","return_type":"Array"}}}', 'word': 'assoc', 'kind': 'Method', 'abbr': 'assoc', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(pos) => Object, nil', 'user_data': '{"lspitem":{
"label":"at","kind":2,"detail":"(pos) => Object, nil","sortText":"0000at","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"at"},"d
ata":{"deprecated":false,"location":null,"path":"Array#at","return_type":"Object"}}}', 'word': 'at', 'kind': 'Method', 'abbr': 'at', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '
', 'user_data': '{"lspitem":{"label":"bsearch","kind":2,"sortText":"0000bsearch","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"
bsearch"},"data":{"deprecated":false,"location":null,"path":"Array#bsearch","return_type":"undefined"}}}', 'word': 'bsearch', 'kind': 'Method', 'abbr': 'bsearch', 'dup': 1, 'icas
e': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"clear","kind":2,"detail":"=> Array","sortText":"0000clear","textEdit":{"range":{"start":{"line":0,"cha
racter":3},"end":{"line":0,"character":3}},"newText":"clear"},"data":{"deprecated":false,"location":null,"path":"Array#clear","return_type":"Array"}}}', 'word': 'clear', 'kind':
'Method', 'abbr': 'clear', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"collect","kind":2,"detail":"=> Array","sortText":"0000collec
t","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"collect"},"data":{"deprecated":false,"location":null,"path":"Array#collect","r
eturn_type":"Array"}}}', 'word': 'collect', 'kind': 'Method', 'abbr': 'collect', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"collec
t!","kind":2,"detail":"=> Array","sortText":"0000collect!","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"collect!"},"data":{"de
precated":false,"location":null,"path":"Array#collect!","return_type":"Array"}}}', 'word': 'collect!', 'kind': 'Method', 'abbr': 'collect!', 'dup': 1, 'icase': 1}, {'info': '', '
menu': '(num) => Array', 'user_data': '{"lspitem":{"label":"combination","kind":2,"detail":"(num) => Array","sortText":"0000combination","textEdit":{"range":{"start":{"line":0,"c
haracter":3},"end":{"line":0,"character":3}},"newText":"combination"},"data":{"deprecated":false,"location":null,"path":"Array#combination","return_type":"Array"}}}', 'word': 'co
mbination', 'kind': 'Method', 'abbr': 'combination', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"compact","kind":2,"detail":"=> Arr
ay","sortText":"0000compact","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"compact"},"data":{"deprecated":false,"location":null
,"path":"Array#compact","return_type":"Array"}}}', 'word': 'compact', 'kind': 'Method', 'abbr': 'compact', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array, nil', 'user_data
': '{"lspitem":{"label":"compact!","kind":2,"detail":"=> Array, nil","sortText":"0000compact!","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3
}},"newText":"compact!"},"data":{"deprecated":false,"location":null,"path":"Array#compact!","return_type":"Array"}}}', 'word': 'compact!', 'kind': 'Method', 'abbr': 'compact!', '
dup': 1, 'icase': 1}, {'info': '', 'menu': '(y) => Array', 'user_data': '{"lspitem":{"label":"concat","kind":2,"detail":"(y) => Array","sortText":"0000concat","textEdit":{"range"
:{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"concat"},"data":{"deprecated":false,"location":null,"path":"Array#concat","return_type":"Array"}}}',
'word': 'concat', 'kind': 'Method', 'abbr': 'concat', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(*args) => Integer', 'user_data': '{"lspitem":{"label":"count","kind":2,"detai
l":"(*args) => Integer","sortText":"0000count","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"count"},"data":{"deprecated":false
,"location":null,"path":"Array#count","return_type":"Integer"}}}', 'word': 'count', 'kind': 'Method', 'abbr': 'count', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(*args) => nil
', 'user_data': '{"lspitem":{"label":"cycle","kind":2,"detail":"(*args) => nil","sortText":"0000cycle","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"char
acter":3}},"newText":"cycle"},"data":{"deprecated":false,"location":null,"path":"Array#cycle","return_type":"nil"}}}', 'word': 'cycle', 'kind': 'Method', 'abbr': 'cycle', 'dup':
1, 'icase': 1}, {'info': '', 'menu': '(item) => nil', 'user_data': '{"lspitem":{"label":"delete","kind":2,"detail":"(item) => nil","sortText":"0000delete","textEdit":{"range":{"s
tart":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"delete"},"data":{"deprecated":false,"location":null,"path":"Array#delete","return_type":"nil"}}}', 'word
': 'delete', 'kind': 'Method', 'abbr': 'delete', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(pos) => Object, nil', 'user_data': '{"lspitem":{"label":"delete_at","kind":2,"detai
l":"(pos) => Object, nil","sortText":"0000delete_at","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"delete_at"},"data":{"depreca
ted":false,"location":null,"path":"Array#delete_at","return_type":"Object"}}}', 'word': 'delete_at', 'kind': 'Method', 'abbr': 'delete_at', 'dup': 1, 'icase': 1}, {'info': '', 'm
enu': '=> Array', 'user_data': '{"lspitem":{"label":"delete_if","kind":2,"detail":"=> Array","sortText":"0000delete_if","textEdit":{"range":{"start":{"line":0,"character":3},"end
":{"line":0,"character":3}},"newText":"delete_if"},"data":{"deprecated":false,"location":null,"path":"Array#delete_if","return_type":"Array"}}}', 'word': 'delete_if', 'kind': 'Me
thod', 'abbr': 'delete_if', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '(n) => Array', 'user_data': '{"lspitem":{"label":"drop","kind":2,"detail":"(n) => Array","sortText":"0000
drop","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"drop"},"data":{"deprecated":false,"location":null,"path":"Array#drop","retu
rn_type":"Array"}}}', 'word': 'drop', 'kind': 'Method', 'abbr': 'drop', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"drop_while","ki
nd":2,"detail":"=> Array","sortText":"0000drop_while","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"drop_while"},"data":{"depre
cated":false,"location":null,"path":"Array#drop_while","return_type":"Array"}}}', 'word': 'drop_while', 'kind': 'Method', 'abbr': 'drop_while', 'dup': 1, 'icase': 1}, {'info': ''
, 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"each","kind":2,"detail":"=> Array","sortText":"0000each","textEdit":{"range":{"start":{"line":0,"character":3},"end":{"li
ne":0,"character":3}},"newText":"each"},"data":{"deprecated":false,"location":null,"path":"Array#each","return_type":"Array"}}}', 'word': 'each', 'kind': 'Method', 'abbr': 'each'
, 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Array', 'user_data': '{"lspitem":{"label":"each_index","kind":2,"detail":"=> Array","sortText":"0000each_index","textEdit":{"ran
ge":{"start":{"line":0,"character":3},"end":{"line":0,"character":3}},"newText":"each_index"},"data":{"deprecated":false,"location":null,"path":"Array#each_index","return_type":"
Array"}}}', 'word': 'each_index', 'kind': 'Method', 'abbr': 'each_index', 'dup': 1, 'icase': 1}, {'info': '', 'menu': '=> Boolean', 'user_data': '{"lspitem":{"label":"empty?","ki
-- More --
Environment
- neovim/vim version (
nvim --version
orvim --version
):
› nvim --version
NVIM v0.3.1
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20181019-50893-1j0fv9i/neovim-0.3.1/build/config -I/tmp/neovim-20181019-50893-1j0fv9i/neovim-0.3.1/src -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/tmp/neovim-20181019-50893-1j0fv9i/neovim-0.3.1/build/src/nvim/auto -I/tmp/neovim-20181019-50893-1j0fv9i/neovim-0.3.1/build/include
Compiled by [email protected]
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.1/share/nvim"
Run :checkhealth for more info
- This plugin version (
git rev-parse --short HEAD
):
› git rev-parse --short HEAD
12a1f60
- This plugin's binary version (
bin/languageclient --version
):
› bin/languageclient --version
languageclient 0.1.132 cffa8b55eb93d33bc00795c8c85ea7dc6912f21f
- Minimal vimrc content (A minimal vimrc is the smallest vimrc that could reproduce the issue. Refer to an example [here][min-vimrc.vim]):
call plug#begin("$HOME/.config/nvim/plugged")
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh'}
call plug#end()
let g:LanguageClient_serverCommands = { 'ruby': ['solargraph', 'stdio'] }
let g:LanguageClient_autoStart=1
let g:LanguageClient_autoStop=1
- Language server link and version:
https://github.com/castwide/solargraph
› solargraph -v
0.29.5
To Reproduce
Steps to reproduce the behavior:
- Create minimum
init.vim
file (must have vim-plug installed) or use theDockerfile
approach below. - Open a ruby file in Neovim, ex:
nvim ruby.rb
- Assign a hash to a variable:
a = []
- Attempt to invoke the LanguageClient:
a. #<-- This should display a menu with language specific options
Current behavior
A menu appears when invoked directly off the object, ex: [].
but not off a variable reference, ex: a = []; a.
Expected behavior
The same menu should appear for a = []; a.
as for [].
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Not sure if you guys use Docker, but I've created a Dockerfile
for you to more easily reproduce the environment and assert the issue:
Dockerfile approach
Step 1
Create a file on your local machine and name it Dockerfile
Step 2
Paste the following into your Dockerfile
FROM ruby:2.4.5-alpine3.8
RUN apk update && apk upgrade && apk add build-base
RUN apk update && apk upgrade && apk --no-cache add \
bash \
cmake \
neovim \
python \
python-dev \
python3 \
python3-dev \
py-pip \
curl \
vim \
nodejs\
git \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip install --upgrade pip
WORKDIR ~
RUN pip3 install neovim
RUN mkdir -p ~/vendor/gems
RUN gem install neovim
RUN gem install solargraph
RUN mkdir -p ~/.config/nvim/autoload
RUN curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
RUN echo $'call plug#begin("$HOME/.config/nvim/plugged")\n\
Plug \'sirver/ultisnips\'\n\
Plug \'honza/vim-snippets\'\n\
Plug \'Valloric/Youcompleteme\', { \'do\': \'./install.py\' }\n\
Plug \'autozimu/LanguageClient-neovim\', { \'branch\': \'next\', \'do\': \'bash install.sh\'}\n\
call plug#end()\n\
let g:LanguageClient_serverCommands = { \'ruby\': [\'solargraph\', \'stdio\'] }\n\
let g:LanguageClient_autoStart=1\n\
let g:LanguageClient_autoStop=1' > ~/.config/nvim/init.vim
RUN nvim --headless "+silent! PlugInstall!" +qall!
CMD ["irb"]
Step 3
Build the Docker image using the following command:
docker build -t ycm -f Dockerfile .
Note: This may take a while (~5 mins)
Step 4
Launch a Docker container from the image and enter bash using the following command:
docker run -it ycm bash
Step 5
Open a Neovim with a Ruby file from bash:
nvim ruby.rb
Step 6
Wait a few moments for LanguageClient to connect, and then assert that things work on direct objects:
Hash.new(). # <-- This should work
[]. # <-- This should work
"". # <-- This should work
Next attempt to invoke the menu off of referential variables:
a = []
a. # <-- This does not work, but it should
I can confirm this bug. I'd like to add that the menu works when adding a star after the dot
a = []
a. # <-- shows nothing
a.* # <-- shows menu