Open klaustopher opened 2 months ago
I'm struggling with this issue too
I guess you need to update mason to solve this issue.
:MasonUpdate
solved it in my case
Was there an update to Mason that includes a fix for this?
@klaustopher I guess the update triggered a new installation of the dependencies, so in my case because I was already using a different ruby version it worked.
Ok, but manually running this every time is not really an option for me as I am often switching projects with different versions. So my fix mentioned above and manually installing ruby-lsp
(or automating it with rbenv-default-gems plugin)
I override the BUNDLE_GEMFILE env to a global gemfile to prevent this issue.
ruby_lsp = {
cmd_env = { BUNDLE_GEMFILE = vim.fn.getenv('GLOBAL_GEMFILE')},
cmd = { 'ruby-lsp' },
filetypes = { 'ruby', 'eruby' },
root_dir = function()
return vim.loop.cwd()
end,
},
Same issue for me - hardcoding the path for ruby-lsp worked for now though, thanks 🎉
I've searched open issues for similar requests
I've manually reviewed logs to find potential errors
I've recently downloaded the latest plugin version of mason.nvim
Problem description
First, I use
rbenv
to manage my ruby versions.My system ruby is set to 3.3.4 (most current), and then in my project specific folders I am using different ruby versions using the
.ruby-version
file. When I install theruby-lsp
package using mason, it is installed with the system ruby version, that includes compiling theprism
gem that is a natively built C extension that is being linked against the specific ruby version it was built with (so in this case 3.3.4)When I now start neovim in one of my project folders that has a
.ruby-version
file, nvim tries to runruby-lsp
with the project specific ruby (i.e. 3.3.1), but since the installed version in~/.local/share/nvim/mason/ruby-lsp
was built against the system ruby (3.3.4 here). Log file shows:I have currently worked around this in my neovim config, by hardcoding the paths for
ruby-lsp
andrubocop
in myneovim-lspconfig.lua
file, and skipping mason:Expected behavior
Personally, I think that
mason
should support installing theruby-lsp
gem for multiple ruby versions, one way how this could be done, is that instead of installing the gem into~/.local/share/nvim/mason/packages/ruby-lsp
, the current ruby version could be included in the path i.e.~/.local/share/nvim/mason/packages/ruby-3.3.4/ruby-lsp
or similar. This way, the package would be reinstalled with a freshly compiled version ofprism
for the currently used ruby version for each project.Steps to reproduce
ruby-lsp
package using masonAffected packages
ruby-lsp
Neovim version (>= 0.7)
NVIM v0.10.1 Build type: Release LuaJIT 2.1.1724512491
Operating system/version
Darwin mymachine.internal 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 arm64
Healthcheck