[VS Code] Resolve ruby path correctly with chruby#3978
Open
davletovalmir wants to merge 1 commit intoShopify:mainfrom
Open
[VS Code] Resolve ruby path correctly with chruby#3978davletovalmir wants to merge 1 commit intoShopify:mainfrom
davletovalmir wants to merge 1 commit intoShopify:mainfrom
Conversation
Author
|
I have signed the CLA! |
Member
|
Thank you for the PR. I believe this is something specific to your setup. If you take a look at the implementation, chruby overrides You're correct that if you're using 3.2.3, the default Do you have any additional RubyGems or Bundler settings? Also, keep in mind that any configurations you make in shell scripts are not applied to the VS Code NodeJS process. So if you have any RubyGems, Bundler or even chruby configurations in something like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In VS Code and its forks (like
CurserCursor) Ruby LSP doesn't work as intended (if I did interpret the comment invscode/chruby_activation.rbcorrectly LOL).There is sentence in the comment:
I read this as: if we have ruby path with patch version (e.g.
"/home/user/.gem/ruby/3.2.3") we should use it instead of no-patch one (e.g."/home/user/.gem/ruby/3.2.0").But look at the snippet output below:
Maybe it's just my setup, but I have exactly 2 paths. And condition never resolves, leaving me with gems installed by Ruby LSP in the wrong directory (the default one, that we tried to avoid).
Implementation
Path size checking condition is not needed, as
Array#deleteis safe for misses, andfirst_path's existence is checked anyways. So in case of any troubles (aka the only ruby version I have is the one without patch, and thusGem.pathreturns exactly one path) - we still fall back toGem.user_dir.Automated Tests
N/A
Manual Tests
$MY_PROJECT_DIR/.ruby-lsp/home/user/.gem/ruby/3.2.0