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

Language server is started even though enable_language_server for that language is set to false #21367

Open
1 task done
izuzak opened this issue Nov 30, 2024 · 6 comments
Open
1 task done
Labels
awaiting info Issue that needs more information from the user language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors ruby Ruby programming language support

Comments

@izuzak
Copy link
Contributor

izuzak commented Nov 30, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Zed's website on settings says that it's possible to enable/disable language servers for specific languages:

Screenshot 2024-11-30 at 14 53 48@2x

I have this in my Zed config:

  "languages": {
    "Ruby": {
      "enable_language_server": false
    }
  },
  "enable_language_server": true,

I would expect that this enables language servers in general, but disables language servers for the Ruby language.

However, when I start Zed, I see this which implies that Zed wanted to start the ruby-lsp language server:

image

When I click on that, a new tab opens with the long output below and in Zed's log I see this:

2024-11-30T14:54:54.641187+01:00 [INFO] starting language server process. binary path: "/opt/homebrew/opt/ruby/bin/ruby-lsp", working directory: "/Users/izuzak/Developer/foobar", args: []
2024-11-30T14:54:57.716711+01:00 [ERROR] cannot read LSP message headers
2024-11-30T14:54:57.716834+01:00 [ERROR] Broken pipe (os error 32)
2024-11-30T14:54:57.716929+01:00 [ERROR] server shut down
2024-11-30T14:54:57.717002+01:00 [ERROR] Failed to start language server "ruby-lsp": oneshot canceled

ruby-lsp error shown in new tab:

Language server error: ruby-lsp

oneshot canceled
-- stderr--
Ruby LSP> Skipping composed bundle setup since /Users/izuzak/Developer/foobar/.ruby-lsp/Gemfile.lock already exists and is up to date
Ruby LSP> Running bundle install for the composed bundle. This may take a while...
Ruby LSP> Command: (bundle _2.4.1_ check || bundle _2.4.1_ install) 1>&2
Resolving dependencies...
The following gems are missing
...
<long_list_of_gems>
...
Install missing gems with `bundle install`
Authentication is required for rubygems.pkg.foobar.com.
Please supply credentials for this source. You can do this by running:
`bundle config set --global rubygems.pkg.foobar.com username:password`
or by storing the credentials in the `BUNDLE_RUBYGEMS__PKG__GITHUB__COM`
environment variable
Ruby LSP> Running bundle install failed. Trying to re-generate the composed bundle from scratch
Ruby LSP> Running bundle install for the composed bundle. This may take a while...
Ruby LSP> Command: (bundle _2.4.1_ check || bundle _2.4.1_ install) 1>&2
Resolving dependencies...
The following gems are missing
...
<long_list_of_gems>
...
Install missing gems with `bundle install`
Authentication is required for rubygems.pkg.foobar.com.
Please supply credentials for this source. You can do this by running:
`bundle config set --global rubygems.pkg.foobar.com username:password`
or by storing the credentials in the `BUNDLE_RUBYGEMS__PKG__GITHUB__COM`
environment variable
bundler: failed to load command: ruby-lsp (/opt/homebrew/opt/ruby/bin/ruby-lsp)
/opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/definition.rb:523:in `materialize': Could not find <some_gem>-0.8, <some_gem>-0.8 in locally installed gems nor ... <long_list_of_gems> ... in locally installed gems (Bundler::GemNotFound)
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/definition.rb:186:in `specs'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/definition.rb:243:in `specs_for'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/runtime.rb:18:in `setup'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler.rb:170:in `setup'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/ui/shell.rb:159:in `with_level'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/ui/shell.rb:111:in `silence'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/setup.rb:20:in `<top (required)>'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:23:in `run'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli.rb:491:in `exec'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli.rb:34:in `dispatch'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/cli.rb:28:in `start'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/exe/bundle:45:in `block in <top (required)>'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /opt/homebrew/Cellar/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bundler-2.4.1/exe/bundle:33:in `<top (required)>'
	from /opt/homebrew/opt/ruby/bin/bundle:25:in `load'
	from /opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'

This problem isn't a recent change -- it's been like this for a while, and I just decided to finally open an issue for it.

When I set "enable_language_server": false for Ruby, I'd expect Zed not to even attempt to do anything with the language servers for Ruby, instead of attempting to start it for some reason.

If I set the general (non-language specific) enable_language_server option to false, then Zed correctly doesn't start any language serevers.

Environment

Zed: v0.165.0 (Zed Nightly 57a45d80ad1e3d2b7c87d68fc4e3499527543d1f)
OS: macOS 15.1.1
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

@izuzak izuzak added admin read bug [core label] labels Nov 30, 2024
@osiewicz
Copy link
Contributor

osiewicz commented Dec 2, 2024

I can't repro this on my end.

@izuzak
Copy link
Contributor Author

izuzak commented Dec 2, 2024

I can't repro this on my end.

@osiewicz 👋 Thanks for taking a look! How can I help debug/reproduce this? Happy to compile a custom version with additional logging or share more information (what would be helpful?).

@osiewicz
Copy link
Contributor

osiewicz commented Dec 2, 2024

Could you try to repro on Guest account to see whether it is an environment issue by any chance?

@notpeter notpeter changed the title Language server is started even though enable_language_server for that language is set to false Language server is started even though enable_language_server for that language is set to false Dec 13, 2024
@notpeter
Copy link
Member

notpeter commented Dec 13, 2024

Is it possible that there is another Language in addition to Ruby which is triggering the ruby-lsp to spawn? The ruby extension also adds ERB and RBS languages, I wonder if you need to also set enable_language_server for them to.

@notpeter notpeter added awaiting info Issue that needs more information from the user ruby Ruby programming language support language An umbrella label for all programming languages syntax behaviors language server An umbrella label for all language servers and removed triage labels Dec 13, 2024
@temanmd
Copy link

temanmd commented Jan 7, 2025

Is it possible that there is another Language in addition to Ruby which is triggering the ruby-lsp to spawn? The ruby extension also adds ERB and RBS languages, I wonder if you need to also set enable_language_server for them to.

Thanks, it helped me.
Although I had the same issue but with different setting:

"languages": {
    "Ruby": {
      "language_servers": ["solargraph", "rubocop", "!ruby-lsp", "..."]
    },
}

@beniaminzagan
Copy link
Contributor

beniaminzagan commented Feb 21, 2025

Hi, is this still an issue, I see another user was able to fix it by the suggestion above, does this work for you as well?

@beniaminzagan beniaminzagan removed the bug [core label] label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting info Issue that needs more information from the user language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors ruby Ruby programming language support
Projects
None yet
Development

No branches or pull requests

5 participants