-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow PATH lookup #11
Comments
Hi. Unfortunately, only native extensions support this option. To workaround that the Ruby extension uses the current project shell environment to apply many things like activating the correct Ruby version manager or spawning pub fn language_server_command(
&mut self,
language_server_id: &LanguageServerId,
worktree: &zed::Worktree,
) -> Result<zed::Command> {
let binary = self.language_server_binary(language_server_id, worktree)?;
Ok(zed::Command {
command: binary.path,
args: binary.args.unwrap_or_default(),
env: worktree.shell_env(), // Use the project shell environment
})
} Is this setting required for |
Which makes sense. But maybe there's a timing issue with
At least it appears to solve this timing issue for the (With "native extension" you mean extensions built right into Zed, right?) The symptoms I see right now are: I can get the right environment to load for the terminal if and only if I open Zed with However, I've executed |
Aha, I will check if |
None, One question though: When the Ruby extension calls |
My use of binstubs is not relevant, the problem is exactly the same on a vanilla macOS machine. I've compiled the steps to reproduce it for you in this Gist: https://gist.github.com/svoop/b7665ce3f3f7b4fe28d72b8bd66e1bfe (This setup uses The last step in the Gist opens a small FOSS project of mine in Zed. When editing any Ruby source file, Zed logs:
When I open a terminal within Zed, the
Update: After running
|
@vitallium Ping. (Not to push, just forgot to mention you in my two previous comments, so you might not have been notified.) |
No, it does not do that. For this option, there are two possible ways:
|
Thanks for providing a test case. I'll check it and come back with results. |
@svoop I tried to replicate your setup but there is something wrong with it. I used a clean VM with macOS Sonoma. For some reason, the Here is the output when I ran
The
So the
But I have installed
Can you please check this? Perhaps there is something wrong with the provided instructions? Thanks! |
Totally possible since I've kinda grown this on my old Mac. What do you use to spool up virtual Macs, Parallels? |
UTM (and sometimes VMware) |
What happens when you open a new terminal and then
If not, then please check whether the file |
Nope, nothing happens. I checked the UPD As always, rebooting the virtual machine helped! |
So, starting the Zed editor from the Dock gives me the following output from starting the
This is a known issue for |
Ah, should have researched on ruby-lsp issues myself, sorry about that. The issue is closed and the merge was made 3 weeks ago, so 0.21.3 (released 9 days ago) should contain the fix. But when I launch ruby-lsp in either the terminal app or the Zed terminal, I still get the I'll dig in some more tomorrow, have to fly to the movies now. Thanks a lot for all your work, I really appreciate it! |
@vitallium Okay, tried the following in the Zed terminal:
Apparently, on the second launch of Starting Zed with
The log also dumps the PATH it uses with "project environment variables from CLI". And it is different from the PATH set in the Zed terminal. Diffing the two, the following paths are only present in the Zed terminal (newlines added after colons for readability):
These are the paths added by direnv and without them, |
@vitallium Any luck replicating this problem yet? |
The LSP may be installed in different locations depending on whether and which Ruby version manager you use. To leverage the similar problem for Rust, the built-in Rust support has recently ntroduced a
path_lookup
setting, here's the commit:zed-industries/zed#12418
It's used as follows:
As suggested in a thread on
direnv
support in Zed, it appears to be desirable for all LSP setups to implement this setting.How about adding a similar feature to
ruby-lsp
and the other supported LSPs for Ruby?(I'd do a PR, but I haven't written a single line of Rust in my life so far, you don't want me to fiddle with your code.)
The text was updated successfully, but these errors were encountered: