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

Ruby extension doesn't have a working language server by default #25099

Open
ConradIrwin opened this issue Feb 18, 2025 · 1 comment · May be fixed by #25350
Open

Ruby extension doesn't have a working language server by default #25099

ConradIrwin opened this issue Feb 18, 2025 · 1 comment · May be fixed by #25350

Comments

@ConradIrwin
Copy link
Member

Summary

Steps to trigger the problem:

  1. Install ruby via homebrew
  2. Open a ruby project ( https://github.com/vitallium/stimulus-lsp-error-zed )
  3. Install the recommended Ruby extension

Actual Behavior:

  • See failed to run solargraph, application not in path
  • Try brew install solargraph, get a new error (cannot start solargraph, missing dependencies)
  • Try brew install, get a new error (can't find executable solargraph for gem solargraph. solargraph is not currently included in the bundle, perhaps you meant to add it to your Gemfile?)

Expected Behavior:

  • Once the ruby extension is installed, the language server should work.

I think this is possibly fixable in the extension, so want to take a look.

That said, it seems likely we need a new API that would let the extension install solargraph from rubygems. We could use this API to make the Go language also an extension (it currently can't be because it installs with go install). I'm less clear on how to avoid the next few errors, but this feels similar to the work we did to make node-based LSPs work by either using the version from the Gemfile (if it is present) or a silo'd version (if it isn't).

Zed Version and System Specs

Zed: v0.175.0 (Zed Nightly 80458ff)
OS: macOS 15.3.0
Memory: 128 GiB
Architecture: aarch64

@ConradIrwin
Copy link
Member Author

The ruby-lsp path fails similarly.

ruby-lsp says to gem install ruby-lsp, but this didn't put the LSP on my path so I had to set the path to it in my settings.

After that, it still failed to run with:

2025-02-18T10:59:20.138959-07:00 [ERROR] server stderr: "Ruby LSP> Skipping lockfile copies because there's no top level bundle\nRuby LSP> Running bundle install for the composed bundle. This may take a while...\nRuby LSP> Command: (/opt/homebrew/opt/ruby/bin/ruby /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle check || /opt/homebrew/opt/ruby/bin/ruby /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle install) 1>&2\nFetching gem metadata from https://rubygems.org/..........\nResolving dependencies...\nThe following gems are missing\n * irb (1.15.1)\n * logger (1.6.6)\n * rdoc (6.12.0)\n * psych (5.2.3)\n * stringio (3.1.3)\nInstall missing gems with `bundle install`\nFetching gem metadata from https://rubygems.org/..........\nResolving dependencies...\nFetching date 3.4.1\nFetching prettyprint 0.2.0\nFetching stringio 3.1.3\nFetching io-console 0.8.0\nFetching logger 1.6.6\nInstalling prettyprint 0.2.0\nInstalling date 3.4.1 with native extensions\nFetching pp 0.6.2\nInstalling stringio 3.1.3 with native extensions\nInstalling io-console 0.8.0 with native extensions\nInstalling logger 1.6.6\nInstalling pp 0.6.2\nFetching reline 0.6.0\nInstalling reline 0.6.0\nFetching psych 5.2.3\nInstalling psych 5.2.3 with native extensions\nFetching rdoc 6.12.0\nInstalling rdoc 6.12.0\nFetching irb 1.15.1\nInstalling irb 1.15.1\nzsh:1: command not found: chruby\n/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:522:in 'File#initialize': No such file or directory @ rb_sysopen - /opt/homebrew/lib/ruby/gems/3.4.0/bin/.ruby-lsp/Gemfile (Errno::ENOENT)\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:522:in 'IO.open'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:522:in 'block in Bundler.read_file'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/shared_helpers.rb:105:in 'Bundler::SharedHelpers#filesystem_access'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:521:in 'Bundler.read_file'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/dsl.rb:46:in 'block in Bundler::Dsl#eval_gemfile'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/dsl.rb:309:in 'Bundler::Dsl#with_gemfile'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/dsl.rb:45:in 'Bundler::Dsl#eval_gemfile'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/env.rb:52:in 'block in Bundler::Env.report'\n\tfrom <internal:kernel>:91:in 'Kernel#tap'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/env.rb:52:in 'Bundler::Env.report'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/friendly_errors.rb:71:in 'Bundler::FriendlyErrors.request_issue_report_for'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/friendly_errors.rb:50:in 'Bundler::FriendlyErrors.log_error'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/friendly_errors.rb:123:in 'Bundler.with_friendly_errors'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:20:in '<top (required)>'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in 'Kernel#load'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in '<main>'\n/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:600:in 'File#initialize': No such file or directory @ rb_sysopen - /opt/homebrew/lib/ruby/gems/3.4.0/bin/.ruby-lsp/Gemfile.lock (Errno::ENOENT)\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:600:in 'IO.open'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:600:in 'block in Bundler::Definition#write_lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/shared_helpers.rb:105:in 'Bundler::SharedHelpers#filesystem_access'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:599:in 'Bundler::Definition#write_lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:372:in 'Bundler::Definition#lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/installer.rb:226:in 'Bundler::Installer#lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/installer.rb:88:in 'block in Bundler::Installer#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/rubygems.rb:821:in 'block in Gem.open_file_with_flock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/rubygems.rb:816:in 'IO.open'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/rubygems.rb:816:in 'Gem.open_file_with_flock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/rubygems.rb:802:in 'Gem.open_file_with_lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/process_lock.rb:13:in 'block in Bundler::ProcessLock.lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/shared_helpers.rb:105:in 'Bundler::SharedHelpers#filesystem_access'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/process_lock.rb:12:in 'Bundler::ProcessLock.lock'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/installer.rb:71:in 'Bundler::Installer#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/installer.rb:23:in 'Bundler::Installer.install'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli/install.rb:72:in 'Bundler::CLI::Install#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:247:in 'block in Bundler::CLI#install'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/settings.rb:159:in 'Bundler::Settings#temporary'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:246:in 'Bundler::CLI#install'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:28:in 'block in <top (required)>'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:20:in '<top (required)>'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in 'Kernel#load'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in '<main>'\nbundler: failed to load command: ruby-lsp (ruby-lsp)\n/opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/definition.rb:37:in 'Bundler::Definition.build': /opt/homebrew/lib/ruby/gems/3.4.0/bin/.ruby-lsp/Gemfile not found (Bundler::GemfileNotFound)\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:238:in 'Bundler.definition'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler.rb:161:in 'Bundler.setup'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/setup.rb:32:in 'block in <top (required)>'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb:173:in 'Bundler::UI::Shell#with_level'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb:119:in 'Bundler::UI::Shell#silence'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/setup.rb:32:in '<top (required)>'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli/exec.rb:57:in 'Kernel#require_relative'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli/exec.rb:57:in 'Bundler::CLI::Exec#kernel_load'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:452:in 'Bundler::CLI#exec'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:28:in 'block in <top (required)>'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'\n\tfrom /opt/homebrew/Cellar/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/bundler-2.6.2/exe/bundle:20:in '<top (required)>'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in 'Kernel#load'\n\tfrom /opt/homebrew/lib/ruby/gems/3.4.0/bin/bundle:25:in '<main>'\n"

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

Successfully merging a pull request may close this issue.

1 participant