-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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? |
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: