nvim-lspinstall
nvim-lspinstall copied to clipboard
Ruby (Solargraph) Install Modifies Local Bundle Config
When installing the Ruby LSP (solargraph) it modifies one's local bundle config. This has surprising consequences. One of the flags used is --without development
. This is unfortunate as one's Gemfile may very well have development only gems configured, e.g. Spring.
Unfortunately the aforementioned before is the default behaviour for Bundler. This means that the state of --without
needs to be remembered before issuing said command. Further, since one may already have a --path
option set it is prudent to first check if it needs to be issued at all.
are you sure? the script is executed in a different directory. it shouldn't modify anything in your pwd. 🤔
Absolutely 100% sure. I was bitten by this pretty hard earlier this week when all of my...
group :development do
# blah
end
gems didn't install. I verified this after reverting changes to my .bundle/config
and then running :LspInstall ruby
again. Same problem.
Sorry that this happened! I don't know anything about ruby. If you know how to fix this, feel free to make a PR. Otherwise a minimal ruby project and steps to reproduce would be good, maybe I can fix it then :)
I'll see what I can do. My Lua is pretty weak so far. I think, though that the below code is more or less just a string that's executed as a shell script. Correct?
https://github.com/kabouzeid/nvim-lspinstall/blob/f8877c92fa1d0b9e1c25478cfc45a2c0c7029060/lua/lspinstall/servers/ruby.lua#L4-L21
Yes you are correct. And the cwd for when the shell script is executed will be ~/.local/share/nvim/lspinstall/ruby
Some evidence I've gathered:
- Running
:LspInstall ruby
outside of a directory containing a Gemfile works as expected -
pwd
is always as expected -
bundle install
seems to be running the context of the editor's cwd, and not the solargraph dir. This happens even if you change the command to something likecd solargraph && bundle install...