-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Zed Editor package can't use language servers #309662
Comments
Temporary workaround that works for me with Rust Analyzer is to use Create { pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSEnv {
name = "zed";
runScript = "zed";
}).env Then run |
Is zed trying to run the language servers from your PATH, failing and then defaulting to its own binaries ( |
As far as I can tell I think it only tries from the ones it downloads.
|
According to their website, Zed is not yet able to connect with "arbitrary language servers". Maybe we'll have to wait for this to be able to inject our nix built binaries... |
There seems to be an (undocumented) configuration option to override the language server binary it uses for a language: #284064 (comment). EDIT: seems like it only works for C, Tailwind, Rust and Go right now though, since each language has to set it up manually. |
I'm executing Zed in a FHS environment using: {pkgs, ...}: let
zed-fhs = pkgs.buildFHSUserEnv {
name = "zed";
targetPkgs = pkgs:
with pkgs; [
zed-editor
];
runScript = "zed";
};
in {
home.packages = [zed-fhs];
}; And it works quite well. The only problem is that it does not show up in the desktop entries. |
this works for me but every time i open the editor it has to reinitialize and i see this: @vinicius507 is this the same for you? |
Mine is not reinitializing on every launch. I'm using 0.143.7 though. |
okay thanks @bbigras mind sharing the overlay? |
@ioitiki I didn't make an overlay yet, but I made a devShell #324549 (comment) . I also pushed a x86_64 build to cachix. |
I'd recommend leaving a thumbs up at zed-industries/zed#4977 |
|
FWIW for many language servers Zed will first check PATH before trying to download and run its own. Additionally some language servers let you explicitly specify a binary path, which is what I have been doing: "lsp": {
"bash-language-server": {
"binary":{
"path": "/etc/profiles/per-user/myself/bin/bash-language-server",
"arguments": ["start"]
}
},
"clangd": {
"binary":{
"path": "/etc/profiles/per-user/myself/bin/clangd",
"arguments": ["--background-index", "--compile-commands-dir=build"]
}
},
"rust-analyzer": {
"binary": {
"path": "/run/current-system/sw/bin/bash",
"arguments": ["-c", "if [ -e flake.nix ]; then nix develop --command rust-analyzer; else rust-analyzer; fi"]
}
},
"taplo": {
"binary":{
"path": "/etc/profiles/per-user/myself/bin/taplo",
"arguments": ["lsp"]
}
},
"json-language-server": {
"binary":{
"path": "/etc/profiles/per-user/myself/bin/vscode-json-languageserver",
"arguments": ["--stdio"]
}
}
} (the rust-analyzer is a bit hacky but I wanted it to work both for simple projects with no system dependencies and for complex ones with a flake.nix that specifies system deps & stuff) |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/zed-editor-the-server-certificate-could-not-be-validated/49992/2 |
Look like they add direnv support in
Waiting for the stable release. I'm not sure if it can solve our issues, we might need to wait for zed-industries/zed#4978 as well. |
I'm asking because there is some conflicting information out there. Is there any workaround atm to make Zed work (including language servers)? And would I have to provide a shell every time or can I use this workaround #309662 (comment) only in shells? |
It's not so much conflicting information as there being multiple viable workarounds. Pick whichever you like most. |
@Mastermindaxe this works perfectly for me, using that in my nix config and running |
@GaetanLepage I don't think the issue is fixed yet and we should close it, my comment here describe that |
I'll have a look which packages might be missing for rust-analyzer |
@k3yss rust-analyzer inside Zed works fine for me without additional configuration, are you using |
Here are the steps that I am doing: I get a similar error that I described before |
Can you try removing your custom LSP path config and then run |
I tried removing it and am received with the error |
Either |
hmmm... that's weird, do you want me to share any other logs so we know what the exact error is? |
This worked for me to setup I am not sure how it would work natively though : ( |
(not read the whole thread so maybe missing something) Before zed-industries/zed#17075 it would fail miserably to find My config:
|
@yatesco just read the thread. I've posted a config that worked both before and after that PR if you have a flake.nix for your project that provides rust-analyzer. (essentially by running |
Now that zed will check PATH for a node.js installation before downloading its own (as of 0.155.2), maybe we should wrap zed to bring in node from nixpkgs? That should solve the problem for node-based language servers (and copilot & prettier). |
Initial attempt at wrapping Zed to make node-based LSPs Just Work in #354063 |
what about nix-ld ? |
didnt work for me at least I think this is done |
Most of the language servers worked with nix-ld except for Node on account of zed-industries/zed#20524 |
Describe the bug
Zed has the same issue as many other editors where it tries to run dynamically-linked libraries. A FHS chroot like
vscode-fhs
would probably fix this.Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
Zed is able to download and execute the language server of choice.
Additional context
Here is the log entry:
Notify maintainers
@GaetanLepage
@niklaskorz
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: