coc-solargraph icon indicating copy to clipboard operation
coc-solargraph copied to clipboard

coc-solargraph not working at all; failing silently

Open george-carlin opened this issue 3 years ago • 4 comments

I followed the exact instructions in this blog post to try and get Neovim/Coc set up for Ruby development with solargraph, but solargraph doesn't appear to be doing anything. When I open a *.rb file and e.g. save it with obvious syntax errors, coc doesn't detect the errors and there's no discernible difference between my current setup and not having coc/solargraph installed at all. (Apart from the fact that when I initially open the file I see [coc.nvim] Solargraph is ready. in my status bar.)

How do I even begin diagnosing the issue?

I'm using Neovim v0.4.4 on a Mac. coc is installed via vim-plug with Plug 'neoclide/coc.nvim', {'branch': 'release'}. Ruby is installed via asdf. solargraph is installed and available in my path:

$ which solargraph
/Users/george/.asdf/shims/solargraph

I don't think there's a problem with my general Coc setup, because Coc works fine in other, non-Ruby projects. The only coc-related config in my init.vim file is the default suggested stuff from the coc readme, plus the line let g:coc_global_extensions = ['coc-solargraph'] as suggested by the blog post linked above, but if I comment out one or both of these in the config it doesn't make a difference. .solargraph.yml is in the root dir of my project and is just the default file created by solargraph config.

Here's what the output of CocInfo and CocOpenLog look like:

image

What am I doing wrong?

george-carlin avatar Apr 13 '21 09:04 george-carlin

Do you have solargraph.diagnostics set to true? That's what turned it on for me. https://github.com/neoclide/coc-solargraph#diagnostics-linting

mcmire avatar Apr 16 '21 03:04 mcmire

I have similar issues, for example when I try to find the definition of a class or a method it just always says: [coc.nvim] definition not found

ssoulless avatar Jun 03 '21 16:06 ssoulless

I have the similar issues, but I don't know how to report this bug. Do someone give me some tricks? I have set solargraph.diagnostics to true.

yetrun avatar Apr 21 '22 07:04 yetrun

@yetrun @george-carlin I have this issue. Try the following:

Open vim, wait for the solargraph server to launch. Wait a few seconds more that a diagnosis attempts to run.

Execute :CoCInfo

See if you see an exception in the logs.

I got the following exception:

2022-11-22T14:12:18.062 INFO (pid:280894) [extension:coc-solargraph] - /home/user/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph-0.47.2/lib/solargraph/library.rb:354:in `block in diagnose': undefined method `split' for {"require_not_found"=>nil, "exclude"=>["spec/**/*"]}:Hash (NoMethodError)

          args = line.split(':').map(&:strip)\r
                     ^^^^^^

2022-11-22T14:12:18.062 INFO (pid:280894) [extension:coc-solargraph] - 	from /home/user/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph-0.47.2/lib/solargraph/library.rb:348:in `each'
	from /home/user/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph-0.47.2/lib/solargraph/library.rb:348:in `diagnose'
	from /home/zuser/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph-0.47.2/lib/solargraph/language_server/host.rb:211:in `diagnose'
	from /home/user/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph0.47.2/lib/solargraph/language_server/host/diagnoser.rb:66:in `tick'
	from /home/user/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solargraph-0.47.2/lib/solargraph/language_server/host/diagnoser.rb:47:in `block in start'

edit: After digging, seems to be a problem with the Solargraph gem.

Open a ruby terminal, type:

require 'solargraph'
s = Solargraph::Workspace.new
s.config

Check out if the config is indeed your config. Seems like the default config might be bugging.

Samuelfaure avatar Nov 22 '22 13:11 Samuelfaure