zed icon indicating copy to clipboard operation
zed copied to clipboard

get environment variables , path is wrong

Open GengCen-Qin opened this issue 1 year ago • 5 comments

Check for existing issues

  • [x] Completed

Describe the bug / provide steps to reproduce it

when I want to use solargraph to write ruby , I find log show : failed to start language server "solargraph": No such file or directory (os error 2) , image

but in terminal, I can find and use it image

so I think maybe some wrong happen when read environment variables,so I check log: image there just has path:/usr/bin:/bin:/usr/sbin:/sbin

but in my terminal : image

after that, I run rust code : println!("{}",env::var("PATH").unwrap_or_default()); image

I don't kown how to resolve this

Environment

Zed 0.130.6 MacBook Pro (Retina, 13-inch, Mid 2014),version: 11.7.10

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

GengCen-Qin avatar Apr 14 '24 07:04 GengCen-Qin

I find when I open Zed in terminal, it is ok

zed project

when I open Zed in folder, it is not ok image

GengCen-Qin avatar Apr 15 '24 06:04 GengCen-Qin

Which macOS version do you have?

mrnugget avatar Apr 15 '24 12:04 mrnugget

I'm 99% sure that this is fixed in Zed 0.131.x with this: https://github.com/zed-industries/zed/commit/b05aa381aa0f83c7f4809ca67b44568248626e55

You can try that version: https://zed.dev/releases/preview

mrnugget avatar Apr 15 '24 12:04 mrnugget

Ugh... lots of issues related to starting or finding Ruby's LSPs. They may be related to the many installation methods for Ruby, as devs often use "ruby version managers" which mangle the $PATH, sometimes when changing directories, etc. 😵

I usually install solargraph with gem install solargraph into a specific directory (using chruby). With that setup, Zed finds solargraph in my $PATH only if I start zed from the CLI, but not otherwise. 😕

As a temporary workaround, I symlinked solargraph to a local path that does not depend on chruby, or any other ruby version manager. For example:

ln -s ~/.gem/ruby/3.3.0/bin/solargraph ~/.local/bin/solargraph

Sure that's a kludge, but for me that was enough to help Zed to find solargraph consistently. HTH.

oz avatar Apr 19 '24 17:04 oz

I'm 99% sure that this is fixed in Zed 0.131.x with this: b05aa38

You can try that version: https://zed.dev/releases/preview

Thanks you, My Mac version is 11.7.10, version is too low

GengCen-Qin avatar Apr 28 '24 06:04 GengCen-Qin

@mrnugget I tested with 0.132.3 (MacOS/Aarch), but there's still trouble with solargraph. Here's the app log.

2024-04-29T09:34:35-06:00 [INFO] Opening main db
2024-04-29T09:34:35-06:00 [INFO] starting language server "solargraph", path: "/Users/oz/etc/", id: 1
2024-04-29T09:34:35-06:00 [INFO] fetching latest version of language server "solargraph"
2024-04-29T09:34:35-06:00 [INFO] downloading language server "solargraph"
2024-04-29T09:34:35-06:00 [INFO] failed to fetch newest version of language server LanguageServerName("solargraph"). falling back to using "solargraph"
2024-04-29T09:34:35-06:00 [INFO] starting language server. binary path: "solargraph", working directory: "/Users/oz/etc/", args: ["stdio"]
2024-04-29T09:34:35-06:00 [ERROR] failed to start language server "solargraph": No such file or directory (os error 2)
2024-04-29T09:34:35-06:00 [ERROR] server stderr: Some("")
2024-04-29T09:34:35-06:00 [INFO] retrying installation of language server "solargraph" in 1s
2024-04-29T09:34:36-06:00 [INFO] Validation check requested for "solargraph" but it cannot be reinstalled

HTH.

oz avatar Apr 29 '24 15:04 oz