-
Notifications
You must be signed in to change notification settings - Fork 154
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
Client fails with default Lazyvim config #2347
Comments
Just reformatting for easier reading:
|
@ogirginc could you verify that |
Just did a
and follow the steps, bug got the error below:
|
Thanks. This seem to relate to your Ruby installation. Could you try |
Things I have tried but failed:
|
Are you launching the Ruby LSP using ASDF's shim for selecting the correct Ruby version? This is documented in the important note for all editors https://github.com/Shopify/ruby-lsp/blob/main/EDITORS.md#editors. |
I am not sure if I understood the setup process, but before opening this ticket, I have tried some things that I couldn't remember. However, here is what did after your comment:
#!/usr/bin/env bash
export GEM_PATH="/Users/ogirginc/.local/share/nvim/mason/packages/ruby-lsp:$GEM_PATH"
exec /Users/ogirginc/.local/share/nvim/mason/packages/ruby-lsp/bin/ruby-lsp "$@"
return {
{
"neovim/nvim-lspconfig",
opts = {
diagnostics = {
underline = false,
virtual_text = false,
},
servers = {
ruby_ls = {
-- cmd = { "asdf", "exec", "ruby-lsp" },
cmd = { "~/.asdf/shims/ruby-lsp" },
filetypes = { "ruby" },
root_dir = require("lspconfig.util").root_pattern("Gemfile", ".git"),
},
},
},
},
}
#!/usr/bin/env bash
export GEM_PATH="/Users/ogirginc/.local/share/nvim/mason/packages/ruby-lsp:$GEM_PATH"
exec /Users/ogirginc/.asdf/shims/ruby-lsp "$@" |
Commented in Slack thread, but for visibility, I believe this is because Mason doesn't consider the Ruby ABI when installing Ruby LSP servers, and in this case, the native extensions in Prism were linked to a version of Ruby that differs from the one being currently invoked. I use Mason for managing LSP's in my Neovim configuration, but I do not use it to manage any Ruby LSPs. I generally want the version of Standard / Rubocop that ships with a project via |
To fix lsp client failing; - Disable Mason's auto install for ruby_lsp. - Explicit enable for ruby_lsp. - Specify the command to start the lsp client. Shopify/ruby-lsp#2347
I'd like to document this if possible, could you check some things for me please @ogirginc:
|
Of course, & thank you for your work! :)
It does work. However, I wanted to explicitly set it, so I won't forget and get confused by
Unfortunately, it does not work. I have also tried |
Thank you |
- The problem apparently is that Mason does not play nicely with version managers like asdf, rbenv, etc. - On an initial Ruby version, it will work fine. But install a new version of Ruby, and Mason will still try to run ruby_lsp using the old version. - Shopify/ruby-lsp#2347 - ogirginc/dotfiles@2d83daa - https://github.com/Shopify/ruby-lsp/blob/main/EDITORS.md
You can try this: return {
{
"neovim/nvim-lspconfig",
servers = {
ruby_lsp = {
mason = false,
enabled = true,
cmd = { os.getenv("HOME") .. "/.asdf/shims/ruby-lsp" },
},
},
},
},
} |
I think I am OK with hardcoding, but wasn't aware of such an API in Lua! Thank you for sharing :) |
Thank you for this useful thread! I’m just learning LazyVim and had a hard time getting -- ~/.config/nvim/lua/plugins/nvim-lspconfig.lua
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
ruby_lsp = {
mason = false,
cmd = { vim.fn.expand("~/.rbenv/shims/ruby-lsp") },
},
},
},
} Maybe I should be storing this lua config file in another place ? Thanks anyways! |
Description
According to docs, there shouldn't be a need for any configuration when Lazyvim is used. However, that's not the case for me.
Reproduction steps
Error message
Versions
The text was updated successfully, but these errors were encountered: