otavioschwanck / mood-nvim

A Neovim configuration for Rails and Javascript
90 stars 12 forks source link

How to setup solargraph? #16

Closed Rinyaresu closed 1 year ago

Rinyaresu commented 1 year ago

I'm trying to use Solargraph, but I can't make it work for some reason. I've tried uninstalling the gem from my system and using only the project gem with Bundler, but the LSP isn't able to identify it. I also tried using Mason, but it still didn't work, even with the useBundler configuration in the nvim/lua/user path, it seems that the LSP is not using Bundler.

otavioschwanck commented 1 year ago

it should work.

if still not work, paste the :LspInfo and :LspLog here

Rinyaresu commented 1 year ago

I followed your instructions, but unfortunately, it's still not working. btw I'm using asdf.

image

The log is not being updated after removing solargraph from mason. The log below is from the previous version, before the removal.


[START][2023-02-23 22:52:20] LSP logging initiated
[ERROR][2023-02-23 22:52:20] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "Solargraph is listening on stdio PID=986256\n"
[ERROR][2023-02-23 22:52:20] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "(none):166: warning: string literal in condition\n"
[ERROR][2023-02-23 22:52:20] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "(none):166: warning: string literal in condition\n"
[ERROR][2023-02-23 22:52:26] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "--auto-correct is deprecated; use --autocorrect instead.\n"
[ERROR][2023-02-23 22:52:26] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "#<Thread:0x00007f99bd7abd78 /home/kaique/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.48.0/lib/solargraph/language_server/host/message_worker.rb:43 run> terminated with exception (report_on_exception is true):\n"
[ERROR][2023-02-23 22:52:26] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "#<Thread:0x00007f99bd705b08 /home/kaique/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.48.0/lib/solargraph/language_server/host/diagnoser.rb:45 run> terminated with exception (report_on_exception is true):\n"
[ERROR][2023-02-23 22:52:26] .../vim/lsp/rpc.lua:734    "rpc"   "solargraph"    "stderr"    "/home/kaique/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.46.0/lib/rubocop/feature_loader.rb:46:in `rescue in rescue in load': cannot load such file -- rubocop-rspec (LoadError)\n"

In my project, I am using version 0.38.0 of Solargraph. However, Mason was using version 0.48.0

otavioschwanck commented 1 year ago

Try to run bundle on your project. (install mason). LSP will not work when the bundle is not updated.

If not work, the problem is probably because the neovim is not reconizing the asdf version of ruby for some reason. I really recommend switching from asdf to rbenv because it handles ruby better