Why Zed
Recently I have been using my old laptop to code .NET & Astro.js for a project, but I have been frustrated by the fact that my laptop is not powerful enough to handle the load that made it freeze frequently due to OOM errors because of vscode. Tried to add more swap memory, it works and never faced OOM anymore but it burdens the CPU.
Did I tried Neovim? Yes, I tried Neovim, but it didn’t suit well me and it’s hard to set up. So, why Zed?
- it’s fast
- easy to use
- feels like home (keymap vscode-ish)
- support C# development (with some juggling)
Make Zed works well with .NET
Zed supports C# via its c# extension, but as I write this blog, it needs some configuration and unfortunately it is not well documented. So, here is step by step how I configured zed to work with .NET, but before we continue, I use linux mint here, so for other OS please adjust the steps by yourself:
- Install OmniSharp by yourself from here, then make OmniSharp executable by running
chmod +x /path/to/OmniSharp- Install the extension
- Add following configuration into settings.json
"lsp": { "omnisharp": { "binary": { "path": "/path/to/OmniSharp", "arguments": ["-lsp"] } }}- Run
dotnet --infoand see where it is installed, in my case it is here
/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.6/libexec/sdk- Find your
libhostfxr.sois located, since my dotnet is located under/home/linuxbrew/.linuxbrewthen I ranfind /home/linuxbrew/.linuxbrew -name libhostfxr.soand make sure that you have thelibhostfxr.soinstalled. - Now that you found
libhostfxr.so, add this into you bashrc or any other shell configuration file:
export DOTNET_ROOT=/home/linuxbrew/.linuxbrew/Cellar/dotnet/9.0.6/libexec #export PATH=$DOTNET_ROOT:$PATH- And finally, restart zed and enjoy!
Errors that might occur
Here are some errors that I encountered when setting up my zed
1. libhostfxr.so could not be found
The required library libhostfxr.so could not be found.If this is a self-contained application, that library should exist in [/<omnisharp path>]It happened because DOTNET_ROOT in your shell configuration file might be incorrect.
2. Failed to spawn command
Language server omnisharp:
failed to spawn command. path: "<OmniSharp path>", working directory: "<workdir>", args: ["optional", "additional", "args", "-lsp"]-- stderr--Your lsp.omnisharp.binary.path in settings.json might be incorrect, make sure you typed full path and remember that path is case sensitive.
3. Enumeration already finished.
System.InvalidOperationException: Enumeration already finished. at System.SZGenericArrayEnumerator`1.get_Current() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.CommandArgumentEnumerator.get_Current() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.CommandArgumentEnumerator.MoveNext() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessCommandOrParameter(CommandOrParameterArgument arg) at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse(String[] args) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at OmniSharp.CommandLineApplication.Execute(String[] args) in /home/vsts/work/1/s/src/OmniSharp.Host/CommandLineApplication.cs:line 65 at OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_0.<Main>b__0() in /home/vsts/work/1/s/src/OmniSharp.Stdio.Driver/Program.cs:line 84 at OmniSharp.HostHelpers.Start(Func`1 action) in /home/vsts/work/1/s/src/OmniSharp.Host/HostHelpers.cs:line 30your args must be ["-lsp"] only, even though in zed docs it should be ["optional", "additional", "args", "-lsp"]
Still facing a problem? please hit me up through my linkedin, will be gladly to help you out.