-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Use already installed language server if in $PATH
#4978
Comments
Since you mention |
This is actually something I struggled with a lot in most GUI editors. If you have project A already open, and you open project B, that window will inherit the environment (including PATH) from the first project (A). This is because the second window usually reuses the same process, or forks off it. I described some of these pitfalls in #4977 (comment) |
Yes, it's not that straightforward. We already do this: Lines 99 to 106 in 98fff01
What this does:
What I thought we could do: when we weren't started by a ClI and you open a project, we spawn the login shell in that project's directory and use that env. But that is also a bit tricky since you can add projects to a window, you have to remember your "original" env and reset it when switching windows/projects, ... and it's not that obvious to users what the env is. |
I think for this issue specifically, the way the env is loaded is fine, the language servers jut need to take But for #4977 (direnv) support I would be happy to help figure out a good solution. Maybe worth moving the discussion there?
I think that would probably cover most of the cases yeah. On the surface it sounds like a good idea to me.
There's probably no good solution for that, unless you treat each project in the window kind of like its own window/sandbox. So each project runs its own language servers etc. Though that still leaves the integrated terminal which is completely separate. If you use direnv, you would probably want the terminal to inherit the login environment, and let it apply its own environment overrides depending on where you cd to. If you don't use direnv, then I don't know what the appropriate environment should be. |
@szlend agree with you! I think the proposed solution in this ticket -- using a language server if it's in |
Personally I would prefer if all language servers supported loading from |
on top of supporting |
Why this is important: Haskell needs LSP to be compiled against the same version of GHC that the tooling is built with. |
I wrote up some ideas and proposed solutions in #7902 — if you want, can you (whoever wants!) take a look and leave your thoughts and poke holes in it, if possible? |
See also #4977 |
This is now included in today's |
Just to clarify: what landed in the release is support for running |
I sort of noticed. I cannot get digestif working :-) |
So, let us speak about digestif. It is a great language server and with SublimeText it is sufficient to add lines like the following in the setings file.
I have tried everything that comes to mind, for instance
(where digestif is in the $PATH, and I also gave the explicit path, but it does not work) and of course I also added it to the list of language servers for LaTeX. Nothing. Why is this not possible with Zed? I only get warnings like the following in the log
Why is it not possible? What should I do? The documentation is not very helpful. |
There's also zed-latex that supports texlab as the language server: rzukic/zed-latex#2 |
I'm going to go ahead and close this as resolved. Beginning with extension API v0.1.0 (2024-08-14) the [ pub fn which(&self, binary_name: &str) -> Option<String>
// Returns the path to the given binary name, if one is present on the $PATH. I believe all the built in languages (C/C++, Go, Python, Rust, VTSLS) and official Zed Extensions (Clojure, CSharp, Deno, Elixir, Erlang, GLSL, Haskell, Lua, PHP, Protobuf, Terraform, Zig, etc) which don't use NPM packages for LSP installation properly support Thanks all! |
Check for existing issues
Describe the feature
Instead of downloading a language server within Zed, I propose it should first look in
$PATH
if it's already installed and use that one instead. Beyond saving some space, this would also enable using different ls versions, via rustup or direnv (#1025) for example.The text was updated successfully, but these errors were encountered: