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
vscode: Allow setting bundler path #1986
Comments
I'd like to learn more about the use case in detail so I can better assess this feature:
|
Isolation. What happens if you have projects that require conflicting versions of bundler? I need a way to tell ruby-lsp which bundler to use.
I have #!/bin/sh
GEM_HOME=/<redacted>/gems/ruby/3.0.0
BUNDLE_BIN_PATH=/<redacted>/3.0.0/gems/bundler-2.4.18/exe/bundle
BUNDLER_VERSION=2.4.18
BUNDLER_SETUP=/<redacted>/gems/ruby/3.0.0/gems/bundler-2.4.18/lib/bundler/setup
RUBYLIB=/<redacted>/gems/ruby/3.0.0/gems/bundler-2.4.18/lib
... removed for brevity ...
exec "${BUNDLE_BIN_PATH}" "$@" Everything works seamlessly as long as this shim is used as the bundler bin. |
This is not a problem, Bundler already handles this properly. Since the version of Bundler used to create a lockfile is encoded inside the lockfile, Bundler knows which version of Bundler it needs to run, and does so appropriately. Even if this was a problem, you can always run Bundler using $ bundler version
Bundler version 2.5.7 (2024-03-22 commit 199531f621)
$ bundler _2.3.23_ version
Bundler version 2.3.23 (2022-10-05 commit 250d9d485d) |
How do you maKe the vscode extension do that? What you are suggesting the exact opposite of isolation. |
You don't need to, is what I am trying to say.
Bundler is the tool that provides the correct isolation, you don't need any extra tooling on top of it. |
I do, actually. I guess I will have to workaround that by using the custom version manager feature. Could you please clarify under which situations will the extension install the dependencies automatically and when do I have to add them to my Gemfile? I would like to use the custom version manager option and the |
You don't need to add
If you follow the steps here to set up your custom version manager, Ruby LSP will use the Bundler installed for that Ruby automatically. |
I don't think that's correct: ruby-lsp/vscode/src/workspace.ts Lines 175 to 183 in b97e2a0
The extension actually expects me to add ruby-lsp to my bundle if I use the Lines 45 to 52 in b97e2a0
Anyway, I was able to make everything work for my use case after looking at the source code to understand how the extension does things. Thanks. |
No we don't want users to declare
|
@st0012 Isn't that what the server is doing? What triggers the installation of the server in the first place? In the vscode extension source code it looks pretty clear to me that the extension will try to install it by running ruby-lsp/vscode/src/workspace.ts Lines 175 to 183 in b97e2a0
ruby-lsp/vscode/src/workspace.ts Lines 195 to 200 in b97e2a0
Lines 45 to 52 in b97e2a0
Documentation is a bit confusing, IMHO. |
@st0012 is correct. You don't see it in the extension code because the logic for creating the hidden bundle is inside the The server is installed using
Which parts of the documentation is confusing and why?
I still don't think that I was able to fully explain that Bundler is THE isolation tool for Ruby, and that's the whole point of its existence. It feels like you are working against that by creating a more complicated set up, but I can't tell you how to set up your projects at the end of the day. |
I'm sorry to say this but he is not. I think there's a huge misunderstanding here so I will try to explain. My question (this whole thread, actually) was about the extension (I don't understand why he mentioned something that the server is doing). To quote exactly what I asked:
His response was:
As I mentioned before (and pointed to specific bits of the extension's source code that confirm what I was saying) when using the
Again, not correct. I will paste the source code one more time because I think you didn't read it: Lines 45 to 52 in b97e2a0
There's actually a very explicit and clear comment that says:
It's confusing because it doesn't say I have to add EDIT: This user would probably be happy with better documentation or a clear warning that he must add ruby-lsp to his Gemfile when using |
Sure, we can probably make the docs better for this case.
That's not really a concern for us. We develop this infrastructure primarily for our developers at Shopify, and we aim to make sure that people in the community can use it as well. But, we have, on purpose, described this tool as "An opinionated language server for Ruby". If anybody is having problems, they can open an issue describing their problem, and we can see if we have the resources to tend to that. If they give random 1 star ratings, that's not helping anyone and we certainly wouldn't be bothered about it. One can't please everyone all the time, and that's just fine. |
I will repeat again that @st0012 was correct, given your question. This issue's description says "I would like to be able to set a custom bundler path.". When you asked the question:
there was no indication that you were asking anything about a custom gemfile. The question as posed makes it sound like the question is about adding the gem to your gemfile, which something you shouldn't be doing. So @st0012 was correct in his response and for the reasons what it was so. It was only later on that you revealed that your issue/question was about the custom gemfile solution, and in that setting, yes, you are right, you need to bring in all of your dependencies, including the |
We are running around in circles. Thank you for taking the time to engage in this discussion. I hope something good comes out of it. |
I have checked that this feature is not already implemented
Use case
Many people like to keep their ruby environments isolated thus install gems in non standard locations (including bundler). This is generally handled by having shims or env files.
Description
I would like to be able to set a custom bundler path.
Implementation
Provide a config option in vscode and use that bundler.
The text was updated successfully, but these errors were encountered: