Zed: Difference between revisions

Layer-09 (talk | contribs)
Formatting, translation tags, adherence to the manual
Layer-09 (talk | contribs)
mNo edit summary
Line 251: Line 251:
== LSP support ==
== LSP support ==
<translate>
<translate>
<!--T:12-->
<!--T:22-->
Zed downloads language servers into <code>~/.local/share/zed/languages/</code>, which is read-only on NixOS. Instead, use declarative methods to supply LSP binaries.
Zed downloads language servers into <code>~/.local/share/zed/languages/</code>, which is read-only on NixOS. Instead, use declarative methods to supply LSP binaries.
</translate>
</translate>
<translate>
<translate>
<!--T:12a-->
<!--T:23-->
Check <strong>LSP Logs → Server Info</strong> to confirm which binaries are running. Prefer language servers packaged in Nixpkgs so that dependencies are resolved within the Nix store.
Check <strong>LSP Logs → Server Info</strong> to confirm which binaries are running. Prefer language servers packaged in Nixpkgs so that dependencies are resolved within the Nix store.
</translate>
</translate>
Line 261: Line 261:
==== Nix-ld (recommended) ====
==== Nix-ld (recommended) ====
<translate>
<translate>
<!--T:13-->
<!--T:24-->
Enable [[FAQ#I've downloaded a binary, but I can't run it, what can I do?|<code>nix-ld</code>]] so prebuilt language servers can resolve dynamic libraries without wrapping.
Enable [[FAQ#I've downloaded a binary, but I can't run it, what can I do?|<code>nix-ld</code>]] so prebuilt language servers can resolve dynamic libraries without wrapping.
</translate>
</translate>
Line 267: Line 267:
==== FHS wrapper ====
==== FHS wrapper ====
<translate>
<translate>
<!--T:14-->
<!--T:25-->
Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them.
Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them.
</translate>
</translate>
{{code|lang=nix|line=no|1=pkgs.zed-editor.fhsWithPackages (pkgs: with pkgs; [ openssl zlib ])}}
{{code|lang=nix|line=no|1=pkgs.zed-editor.fhsWithPackages (pkgs: with pkgs; [ openssl zlib ])}}
<translate>
<translate>
<!--T:15-->
<!--T:26-->
Remember that language servers started inside the wrapper do not automatically inherit tools from ad-hoc shells; include every dependency declaratively.
Remember that language servers started inside the wrapper do not automatically inherit tools from ad-hoc shells; include every dependency declaratively.
</translate>
</translate>
Line 278: Line 278:
==== Bring your own LSP servers ====
==== Bring your own LSP servers ====
<translate>
<translate>
<!--T:16-->
<!--T:27-->
Newer versions of Zed can detect LSP servers installed in <code>PATH</code> and prefer local versions over automatically downloaded ones. Install LSP servers globally or provide them through nix shell.
Newer versions of Zed can detect LSP servers installed in <code>PATH</code> and prefer local versions over automatically downloaded ones. Install LSP servers globally or provide them through nix shell.
</translate>
</translate>
<translate>
<translate>
<!--T:16a-->
<!--T:28-->
Nixpkgs versions of tools may be required for development on NixOS, especially for the C/C++ ecosystem. Check <strong>LSP Logs → Server Info</strong> to see which binaries are running.
Nixpkgs versions of tools may be required for development on NixOS, especially for the C/C++ ecosystem. Check <strong>LSP Logs → Server Info</strong> to see which binaries are running.
</translate>
</translate>
<translate>
<translate>
<!--T:16b-->
<!--T:29-->
If automatic detection doesn't work, specify the path manually in your Zed configuration:
If automatic detection doesn't work, specify the path manually in your Zed configuration:
</translate>
</translate>
Line 300: Line 300:
}}
}}
<translate>
<translate>
<!--T:16c-->
<!--T:30-->
Adjust the path for each language server you manage. The example above assumes rust-analyzer is installed in your system profile.
Adjust the path for each language server you manage. The example above assumes rust-analyzer is installed in your system profile.
</translate>
</translate>
== Remote server ==
== Remote server ==
<translate>
<translate>
<!--T:17-->
<!--T:31-->
Zed uploads a versioned remote server binary to <code>~/.zed_server</code> on the target host. The Nixpkgs package exposes the matching binary via the <code>remote_server</code> output.
Zed uploads a versioned remote server binary to <code>~/.zed_server</code> on the target host. The Nixpkgs package exposes the matching binary via the <code>remote_server</code> output.
</translate>
</translate>
<translate>
<translate>
<!--T:17a-->
<!--T:32-->
When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge.
When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge.
</translate>
</translate>
Line 317: Line 317:
};}}
};}}
<translate>
<translate>
<!--T:18-->
<!--T:33-->
The <code>recursive = true;</code> setting keeps the directory writable while symlinking individual binaries, allowing Zed to add new versions when needed. This is necessary because the <code>~/.zed_server</code> folder is also used when external clients connect to the current system as a remote.
The <code>recursive = true;</code> setting keeps the directory writable while symlinking individual binaries, allowing Zed to add new versions when needed. This is necessary because the <code>~/.zed_server</code> folder is also used when external clients connect to the current system as a remote.
</translate>
</translate>
<translate>
<translate>
<!--T:18a-->
<!--T:34-->
Alternatively, use Home Manager's built-in option for simpler setup:
Alternatively, use Home Manager's built-in option for simpler setup:
</translate>
</translate>
Line 329: Line 329:
};}}
};}}
<translate>
<translate>
<!--T:18b-->
<!--T:35-->
To restrict remote clients to a specific server version, set <code>recursive = false;</code> to make the entire folder read-only. Zed refuses to connect if it cannot provision the required binary, so document the restriction for collaborators.
To restrict remote clients to a specific server version, set <code>recursive = false;</code> to make the entire folder read-only. Zed refuses to connect if it cannot provision the required binary, so document the restriction for collaborators.
</translate>
</translate>
Line 338: Line 338:
{{code|lang=bash|line=no|1=$ vulkaninfo --summary}}
{{code|lang=bash|line=no|1=$ vulkaninfo --summary}}
<translate>
<translate>
<!--T:22-->
<!--T:36-->
Run the command above to check your Vulkan support before launching Zed. Install <code>vulkan-tools</code> if the command is not available. On non-NixOS systems, you may need to wrap Zed with <code>nixGLVulkan</code> from the nixGL package.
Run the command above to check your Vulkan support before launching Zed. Install <code>vulkan-tools</code> if the command is not available. On non-NixOS systems, you may need to wrap Zed with <code>nixGLVulkan</code> from the nixGL package.
</translate>
</translate>
Line 352: Line 352:
}}
}}
<translate>
<translate>
<!--T:23-->
<!--T:37-->
Declaratively listing extensions ensures they are installed automatically on new systems while still allowing additional extensions to be added interactively.
Declaratively listing extensions ensures they are installed automatically on new systems while still allowing additional extensions to be added interactively.
</translate>
</translate>
Line 358: Line 358:
==== Synchronise settings across machines ====
==== Synchronise settings across machines ====
<translate>
<translate>
<!--T:24-->
<!--T:38-->
Store the entire <code>~/.config/zed</code> directory in a version-controlled dotfiles repo or manage it with Home Manager to keep settings consistent across hosts.
Store the entire <code>~/.config/zed</code> directory in a version-controlled dotfiles repo or manage it with Home Manager to keep settings consistent across hosts.
</translate>
</translate>
Line 366: Line 366:
==== Zed fails to start without Vulkan ====
==== Zed fails to start without Vulkan ====
<translate>
<translate>
<!--T:25-->
<!--T:39-->
If the GUI refuses to launch, confirm that <code>vulkan-tools</code> reports a working ICD. Use <code>nixGL</code> or vendor packages that supply Vulkan drivers for your GPU.
If the GUI refuses to launch, confirm that <code>vulkan-tools</code> reports a working ICD. Use <code>nixGL</code> or vendor packages that supply Vulkan drivers for your GPU.
</translate>
</translate>
Line 372: Line 372:
==== Remote collaboration disconnects ====
==== Remote collaboration disconnects ====
<translate>
<translate>
<!--T:26-->
<!--T:40-->
Ensure the remote server binary matches the client version. Re-run <code>home-manager switch</code> or update the symlink in <code>~/.zed_server</code> if the versions diverge after an update.
Ensure the remote server binary matches the client version. Re-run <code>home-manager switch</code> or update the symlink in <code>~/.zed_server</code> if the versions diverge after an update.
</translate>
</translate>
Line 378: Line 378:
==== Language server missing binaries ====
==== Language server missing binaries ====
<translate>
<translate>
<!--T:27-->
<!--T:41-->
When Zed reports missing tools, add the required executables to <code>programs.zed-editor.extraPackages</code> or wrap the server using <code>pkgs.writeShellApplication</code>.
When Zed reports missing tools, add the required executables to <code>programs.zed-editor.extraPackages</code> or wrap the server using <code>pkgs.writeShellApplication</code>.
</translate>
</translate>
Line 384: Line 384:
== See also ==
== See also ==
* <translate>
* <translate>
<!--T:28-->
<!--T:42-->
[[Home Manager]] – Manage Zed configuration declaratively
[[Home Manager]] – Manage Zed configuration declaratively
</translate>
</translate>
* <translate>
* <translate>
<!--T:29-->
<!--T:43-->
[[Graphics#Vulkan]] – Set up Vulkan on NixOS systems
[[Graphics#Vulkan]] – Set up Vulkan on NixOS systems
</translate>
</translate>
* <translate>
* <translate>
<!--T:30-->
<!--T:44-->
[https://search.nixos.org/options?query=zed-editor NixOS options search for Zed]
[https://search.nixos.org/options?query=zed-editor NixOS options search for Zed]
</translate>
</translate>