Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coc-solargraph not working at all; failing silently #59

Open
george-carlin opened this issue Apr 13, 2021 · 4 comments
Open

coc-solargraph not working at all; failing silently #59

george-carlin opened this issue Apr 13, 2021 · 4 comments

Comments

@george-carlin
Copy link

george-carlin commented Apr 13, 2021

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?

@mcmire
Copy link

mcmire commented Apr 16, 2021

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

@ssoulless
Copy link

ssoulless commented Jun 3, 2021

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

@yetrun
Copy link

yetrun commented Apr 21, 2022

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.

@Samuelfaure
Copy link

Samuelfaure commented Nov 22, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants