-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Support shimmed ruby versions #1407
Support shimmed ruby versions #1407
Conversation
yess, thank you! I've been banging my head against the wall trying to upgrade a large codebase to prettier 3, and this was the last blocker. Just tried your fix locally and it works |
Hey @hrabe - I think this makes sense to me. Happy to merge, but let's make sure we get CI green first. You should be able to rebase off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just marking this as "request changes"
@kddnewton all tests locally running well now. |
@hrabe it looks like everything is failing on CI with this PR. Any chance it's unable to find the correct bundle now that the cwd is changing? Are you able to replicate locally? |
@kddnewton Now using the cwd only if file is given. Now clue how to reproduce CI issue, cause |
@kddnewton do you think we could bump a new version? |
The plugin currently only works, if in shimmed environment (e.g. rbenv / asdf) the global ruby version it the same as within the project. If global ruby version is something like 2.7.0 it fails within vscode format on save.
This is due to starting the ruby interpreter (spawn) within drives root folder, which falls back to global ruby version instead of project used one.
The fix sets the working dir for spawned ruby process to the directory, where the file to be formatted is contained.
This will automatically use the correct shimmed ruby version of the project or falls back (if no shim has been used) to global ruby version.
This also may make the .editorconfig obsolete.