mason-lspconfig.nvim icon indicating copy to clipboard operation
mason-lspconfig.nvim copied to clipboard

Solargraph crashes on Ruby file open

Open paulalden opened this issue 3 years ago • 9 comments

Problem description

Opening a Ruby file causes an error message:

2022-07-28T21:17:01  WARN Client 3 quit with exit code 1 and signal 0

Why do you think this is an issue with mason-lspconfig.nvim?

LSP functionality works correctly using Nvim Lsp Install

Neovim version (>= 0.7)

NVIM v0.8.0-dev-nightly-221-g1a07044c1 Build type: Release LuaJIT 2.1.0-beta3

Operating system/version

Darwin M1MacBookPro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • [X] Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • [X] Yes

Affected language servers

Solargraph 0.45.0

Steps to reproduce

Install via Mason Open Ruby file

Actual behavior

No LSP for Ruby files

Expected behavior

LSP for Ruby files

LspInfo

Language client log: /Users/paul/.local/state/nvim/lsp.log
 Detected filetype:   ruby
 
 0 client(s) attached to this buffer: 
 
 1 active client(s) not attached to this buffer: 
 
 Client: sumneko_lua (id: 1, pid: 8360, bufnr: [6])
 	filetypes:       lua
 	autostart:       true
 	root directory:  /Users/paul/Personal/Repos/dotfiles
 	cmd:             lua-language-server
 
 Other clients that match the filetype: ruby
 
 Config: solargraph
 	filetypes:         ruby
 	root directory:    /Users/paul/Dev/api
 	cmd:               solargraph stdio
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: tsserver, sqlls, lemminx, html, dockerls, cssls, bashls, jsonls, solargraph, sumneko_lua, yamlls

LspLog

[START][2022-07-28 21:19:24] LSP logging initiated
[ERROR][2022-07-28 21:19:24] .../vim/lsp/rpc.lua:439	"rpc"	"solargraph"	"stderr"	"/Users/paul/.asdf/installs/ruby/3.1.1/lib/ruby/site_ruby/3.1.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem solargraph (>= 0.a) with executable solargraph (Gem::GemNotFoundException)\n\tfrom /Users/paul/.asdf/installs/ruby/3.1.1/lib/ruby/site_ruby/3.1.0/rubygems.rb:284:in `activate_bin_path'\n\tfrom /Users/paul/.local/share/nvim/mason/bin/solargraph:25:in `<main>'\n"
[ERROR][2022-07-28 21:19:24] .../vim/lsp/rpc.lua:439	"rpc"	"solargraph"	"stderr"	"/Users/paul/.asdf/installs/ruby/3.1.1/lib/ruby/site_ruby/3.1.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem solargraph (>= 0.a) with executable solargraph (Gem::GemNotFoundException"
[ERROR][2022-07-28 21:19:24] .../vim/lsp/rpc.lua:439	"rpc"	"solargraph"	"stderr"	")\n\tfrom /Users/paul/.asdf/installs/ruby/3.1.1/lib/ruby/site_ruby/3.1.0/rubygems.rb:284:in `activate_bin_path'\n\tfrom /Users/paul/.local/share/nvim/mason/bin/solargraph:25:in `<main>'\n"


### Healthcheck

```Text
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - WARNING: **Go**: not available
  - WARNING: **cargo**: not available
  - OK: **luarocks**: `/opt/homebrew/bin/luarocks 3.9.1`
  - OK: **Ruby**: `ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]`
  - OK: **RubyGem**: `3.3.10`
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `6.14.15`
  - OK: **node**: `v14.18.3`
  - OK: **python3**: `Python 3.9.13`
  - OK: **pip3**: `pip 22.1.1 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)`
  - WARNING: **javac**: not available
  - WARNING: **java**: not available
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 6. Remaining: 54. Limit: 60. Reset: Thu 28 Jul 21:26:47 2022.


### Screenshots or recordings

_No response_

paulalden avatar Jul 28 '22 20:07 paulalden

Hey! This is due to https://github.com/williamboman/mason.nvim/issues/152. Unfortunately all gem-based packages (three of them in total) are not functional yet with Mason. I've been reading up and experimenting with different solutions, will hopefully land something today

williamboman avatar Jul 29 '22 11:07 williamboman

Thank you for confirming. I look forward to any updates you're able to make.

Thank you for the time you've put into this project.

On Fri, 29 Jul 2022, 13:00 William Boman, @.***> wrote:

Hey! This is due to williamboman/mason.nvim#152 https://github.com/williamboman/mason.nvim/issues/152. Unfortunately all gem-based packages (three of them in total) are not functional yet with Mason. I've been reading up and experimenting with different solutions, will hopefully land something today

— Reply to this email directly, view it on GitHub https://github.com/williamboman/mason-lspconfig.nvim/issues/14#issuecomment-1199194772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJE62PQ2O3GLGPDAJGH4C3VWPBUHANCNFSM546RCRNA . You are receiving this because you authored the thread.Message ID: @.***>

paulalden avatar Jul 29 '22 12:07 paulalden

Hey this should be fixed now. Let's reopen if you're still experiencing issues (you'll need to reinstall affected packages)

williamboman avatar Jul 30 '22 22:07 williamboman

Hey this should be fixed now. Let's reopen if you're still experiencing issues (you'll need to reinstall affected packages)

Unfortunately, using the same config as LspInstaller (but following the instructions to switch to Mason LSP Installer), i'm getting the same issue with the Solargraph LSP. Lua's LSP works perfectly.

paulalden avatar Aug 02 '22 18:08 paulalden

Unfortunately, using the same config as LspInstaller (but following the instructions to switch to Mason LSP Installer), i'm getting the same issue with the Solargraph LSP. Lua's LSP works perfectly.

Hmm.. Are you getting any errors? Can you run $ solargraph stdio in the terminal (:term)?

williamboman avatar Aug 05 '22 19:08 williamboman

I am able to run solargraph stdio (once I manually install the gem).

When I open a Ruby file in Nvim with Mason installed, I get the following:

Error executing luv callback:
vim/shared.lua:0: attempt to index a nil value
stack traceback:
        vim/shared.lua: in function 'tbl_get'
        ...neovim/HEAD-3ee6c05_1/share/nvim/runtime/lua/vim/lsp.lua:403: in function 'get_group'
        ...neovim/HEAD-3ee6c05_1/share/nvim/runtime/lua/vim/lsp.lua:525: in function 'reset'
        ...neovim/HEAD-3ee6c05_1/share/nvim/runtime/lua/vim/lsp.lua:1151: in function 'on_exit'
        ...im/HEAD-3ee6c05_1/share/nvim/runtime/lua/vim/lsp/rpc.lua:329: in function <...im/HEAD-3ee6c05_1/s
hare/nvim/runtime/lua/vim/lsp/rpc.lua:321>
        [C]: in function '__newindex'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:8: in function 'setf'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:14: in function 'set_filetype'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:65: in function 'try_lookup'
        ...te/pack/packer/start/filetype.nvim/lua/filetype/init.lua:158: in function 'resolve'
        [string ":lua"]:1: in main chunk
        [C]: at 0x010239abb0
        [C]: in function 'pcall'
        ...site/pack/packer/start/auto-session/lua/auto-session.lua:480: in function 'restore'
        ...site/pack/packer/start/auto-session/lua/auto-session.lua:519: in function <...site/pack/packer/st
art/auto-session/lua/auto-session.lua:471>
        [C]: in function 'cmd'
        ...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:110: in function 'apply_cause_side_effct
s'
        ...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:158: in function <...m/site/pack/packer/
start/packer.nvim/lua/packer/load.lua:118>
        [C]: in function 'pcall'
        ...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:162: in function <...m/site/pack/packer/
start/packer.nvim/lua/packer/load.lua:161>
        [string ":lua"]:1: in main chunk

paulalden avatar Aug 11 '22 20:08 paulalden

Have the same trouble with solargraph. From :term it looks fine:

solargraph stdio          ✔  3.0.2 
Solargraph is listening on stdio PID=3661

But in LspLog:

[ERROR][2022-08-12 03:06:54] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"Solargraph is listening on stdio PID=3753\n"
[ERROR][2022-08-12 03:06:55] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"[WARN] /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/bundler-2.3.20/lib/bundler/definition.rb:514:in `materialize': Could not find racc-1.6.0 in locally installed gems (Bundler::GemNotFound)\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/bundler-2.3.20/lib/bundler/definition.rb:257:in `specs_for'\n\tfrom -e:1:in `block in <main>'\n\tfrom -e:1:in `chdir'\n\tfrom -e:1:in `<main>'\n\n"
[ERROR][2022-08-12 03:06:55] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"[WARN] Failed to load gems from bundle at /Users/mario/work/this_moment\n"
[ERROR][2022-08-12 03:06:57] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"#<Thread:0x0000000112edddf8 /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/language_server/host/diagnoser.rb:45 run> terminated with exception (report_on_exception is true):\n"
[ERROR][2022-08-12 03:06:57] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"<internal:/Users/mario/.rbenv/versions/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- rubocop-rails (LoadError)\n"
[ERROR][2022-08-12 03:06:57] .../vim/lsp/rpc.lua:420	"rpc"	"solargraph"	"stderr"	"\tfrom <internal:/Users/mario/.rbenv/versions/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/feature_loader.rb:35:in `load'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/feature_loader.rb:21:in `load'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader_resolver.rb:13:in `each'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'\n\tfrom <internal:kernel>:90:in `tap'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader.rb:46:in `load_file'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_loader.rb:104:in `configuration_from_file'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_store.rb:68:in `for_dir'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/config_store.rb:58:in `for'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:190:in `block in process_explicit_path'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:189:in `reject'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:189:in `process_explicit_path'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:40:in `block in find'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:36:in `each'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/target_finder.rb:36:in `find'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/runner.rb:81:in `find_target_files'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/rubocop-1.34.1/lib/rubocop/runner.rb:42:in `run'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/diagnostics/rubocop.rb:29:in `block in diagnose'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/diagnostics/rubocop_helpers.rb:57:in `redirect_stdout'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/diagnostics/rubocop.rb:29:in `diagnose'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/library.rb:363:in `block in diagnose'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/library.rb:362:in `each_pair'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/library.rb:362:in `diagnose'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/language_server/host.rb:211:in `diagnose'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/language_server/host/diagnoser.rb:66:in `tick'\n\tfrom /Users/mario/.local/share/nvim/mason/packages/solargraph/gems/solargraph-0.45.0/lib/solargraph/language_server/host/diagnoser.rb:47:in `block in start'\n"

mario-amazing avatar Aug 11 '22 23:08 mario-amazing

This and the other comment I deleted were a case of face planting in text. Being wrong definitely feels like being right.

I just re-tested https://github.com/williamboman/mason.nvim/pull/202 effects while making sure my work environment doesn't introduce side effects (cough Gemfile.lock changes cough), and it just works. My apologies for introducing noise to this issue.

Slotos avatar Oct 06 '22 01:10 Slotos

Screenshot_20221104_220143

I can't install any ruby lsp.

Cannot link Gem executable "ruby-lsp" because it doesn't exist in "bin/ruby-lsp".

LiberaTeMetuMortis avatar Nov 04 '22 19:11 LiberaTeMetuMortis