fix(ruby): Normalize Ruby command PWD to the worktree root#288
Open
vitallium wants to merge 2 commits into
Open
fix(ruby): Normalize Ruby command PWD to the worktree root#288vitallium wants to merge 2 commits into
vitallium wants to merge 2 commits into
Conversation
This change makes Ruby-related commands run with a consistent PWD derived from the current worktree root. It adds a shared environment helper and uses it when: - invoking Bundler - resolving Ruby language server binaries - launching language servers from configured binaries, PATH, and the extension gemset Why: - Zed does not guarantee commands run from the project root - Ruby version managers like asdf and mise rely on PWD to detect the correct project Ruby - without this normalization, Bundler and language servers can resolve the wrong Ruby or gem context This is a hack, yes. And I am sorry about that.
The previous PWD-based attempt did not change the child process working directory, so Bundler and RubyGems could still resolve the wrong Ruby. Run extension-side bundle/ruby/gem probes through a worktree-root shell wrapper instead, and allow that wrapper in the manifest so fallback installation uses the same project context as the final language server.
7177e2e to
d11bc41
Compare
vitallium
commented
May 11, 2026
Comment on lines
+92
to
+95
| [[capabilities]] | ||
| kind = "process:exec" | ||
| command = "sh" | ||
| args = ["-c", "*"] |
Collaborator
Author
There was a problem hiding this comment.
@MrSubidubi Just checking-in, after zed-industries/zed#52249 was closed, the Ruby extensions is a bit broken due to that. I found this solution to the problem described in the PR.
- Since this extension must run some Ruby setup commands (bundle/ruby/gem) from the
worktree root so version managers like mise/asdf resolve the project Ruby
correctly. - AND The Zed extension process API does not expose a way to set the child process working directory
So I wonder if we can use sh -c as a minimal
cwd wrapper around those commands. I understand that sh -c * is quite broad pattern so I would like to hear your thoughts! Thanks!
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.
This change makes Ruby-related commands run with a consistent PWD derived from the current worktree root. It adds a shared environment helper and uses it when:
This is a hack, yes. And I am sorry about that.