-
Notifications
You must be signed in to change notification settings - Fork 52
Implement internal Ruby activation mechanism #923
Conversation
dff7eb1
to
dc787b5
Compare
95e0d0f
to
f92d28d
Compare
dc787b5
to
7f64d9f
Compare
21831bf
to
32f6521
Compare
Hi, I'm seeing similar issue to @Nowaker, only I'm using mise. macos I have a
I get the same So far the only solution I've found is to use the release version (which works fine with this) or hardcode the path, which is not ideal.
|
78a842e
to
b781d2b
Compare
@Nowaker are your rubies installed under @DuncSmith what's the purpose of the |
b781d2b
to
a98af41
Compare
I'd add the local version to my gitignore and use it to override any default config. But I think though this was a bad example on my part, apologies. I do see the same issue with a project specific |
a98af41
to
3486b11
Compare
@vinistock Yes to both. A standard RVM installation. |
@Nowaker And you don't have any other logs after the line you already mentioned? It discovered the right version and then stopped printing?
|
@DuncSmith I'm not a user of Mise, so I'm going to need more information to get the implementation right.
|
@vinistock Correct, no more logs than what I provided. Happy to provide more information if I'm told where and what exactly to look up. Thanks :) |
3486b11
to
1b1bd56
Compare
@Nowaker if the directories are the default ones, then I suspect it's some permission issue. We were using I changed the code to use Please let me know what happens when you upgrade. |
@vinistock Aye aye. But how do I check - did you release a new pre-release version to the VS Code Marketplace? As that's how I tested the thing. |
Yup, I just shipped |
Hi @vinistock 👋 i'm using the rubyLsp extension in a vscode my setup
debugging steps
|
I was able to resolve this by setting |
The improvements identified with the help of this PR have all been shipped in the stable version of the Ruby LSP extension. In addition to that, all the code has been moved to our monorepo https://github.com/Shopify/ruby-lsp. |
Motivation
Closes Shopify/ruby-lsp#1776, closes Shopify/ruby-lsp#1784, closes Shopify/ruby-lsp#1794, closes Shopify/ruby-lsp#1216, closes Shopify/ruby-lsp#1762
Currently, we activate the Ruby environment using the user's version manager invoked through a shell. This is necessary because most version managers are shell scripts loaded in config files like
~/.zshrc
or~/.bashrc
.Unfortunately, this has been causing headache because some shell plugins or configurations may accidentally block or interact with our activation script, which leads to difficult to debug issues.
I believe we can provide a better experience if we provide a minimal Ruby environment activation mechanism implemented directly inside TypeScript so that we can avoid interacting with the shell altogether.
Possible drawbacks
While this will fix the issues related to interacting with the shell, it's not free of drawbacks. Certain version managers provide more complex functionality that may not be supported by our internal mechanism.
For example,
rtx
supports adding extra environment variables in its.rtx.toml
file. Other version managers allow users to change the defaultGEM_HOME
where user gems are installed.Moving forward with this approach means that we might need to add some extra complexity to handle this scenarios or at least make certain things configurable.
Release strategy
We will need to have a long preview release cycle for this one to ensure that activation is working fine for common setups.
Implementation
The bulk of the changes are in
Ruby
. All other changes are just putting pieces together.The idea of the activation mechanism is that we
.ruby-version
,dev.yml
,.tools-versions
,.rtx.toml
)GEM_HOME
andGEM_ROOT
to usbin
folderAutomated Tests
Added tests for all different config files we support.
Manual Tests
We need to ensure that Ruby environment activation works properly for
chruby
,rbenv
,rvm
,shadowenv
,rtx
andasdf
.For all of them, the manual tests are analogous:
.ruby-version
)