Zed: Difference between revisions
m Hyperlink package, home manager, and vulkan. Fix console formatting |
Update LSP support section with latest changes in upstream and nixpkgs. |
||
| Line 13: | Line 13: | ||
== LSP Support == | == LSP Support == | ||
By default, Zed will try to download pre-built LSP servers in <code>~/.local/share/zed/languages/</code> | By default, Zed will try to download pre-built LSP servers in <code>~/.local/share/zed/languages/</code>, which doesn't work on NixOS. | ||
There | There are a couple of ways to workaround the issue. | ||
=== Nix-ld (recommended) === | |||
[[FAQ#I've downloaded a binary, but I can't run it, what can I do?]] | |||
Nix tooling and Zed's out-of-the-box features will work seamlessly. You can also bring your own LSP servers as well (see below). | |||
=== Fhs wrapper === | |||
Nixpkgs provides a FHS wrapper of Zed, <code>pkgs.zed-editor-fhs</code> or <code>zed-editor.fhs</code>. | |||
You can extend the packages provided by FHS environment via <code>fhsWithPackages</code> if the LSP requires some system library to work.<syntaxhighlight lang="nix"> | |||
pkgs.zed-editor.fhsWithPackages (pkgs: (with pkgs; [ openssl ])) | |||
</syntaxhighlight>Note that LSP servers in FHS wrapper might not be able to detect system libraries provided by nix shell. | |||
=== Bring your own LSP servers === | |||
Newer versions of Zed should be able to detect LSP servers installed in <code>PATH</code>, and prefers local versions instead of automatically installed versions. You can install the LSP servers globally or provide them through nix shell. | |||
Nixpkgs version of tools might be required for development on NixOS, especially for C/C++ ecosystem. | |||
You can see the path of running LSP via "LSP Logs" > "Server Info". | |||
If that doesn't work, you can specify the path manually, e.g. for rust-analyzer: | |||
Here, we'll assume rust-analyzer is globally installed in your system profile at <code>/run/current-system/sw/bin/rust-analyzer</code>. You may want to adapt this path in the following code snippet to something more relevant to your use case. | Here, we'll assume rust-analyzer is globally installed in your system profile at <code>/run/current-system/sw/bin/rust-analyzer</code>. You may want to adapt this path in the following code snippet to something more relevant to your use case. | ||