Tried Building a C# Development Environment in Zed
Summarized the steps and pitfalls to introduce a C# language server to Zed and enable completion and definition jumping in Unity projects
Hello! I'm PanKUN.
This time, I will summarize how to create an environment where you can write Unity C# comfortably with the Zed editor, which I have been switching to recently.
In conclusion,
- Zed alone cannot parse Unity C#.
- It is necessary to configure and use an external C# language server (csharp-language-server).
- You can easily get stuck even with insufficient .NET runtime versions.
- Since Unity projects are huge, it becomes heavy if you don't narrow down the "folders to open".
There are such characteristics.
In this article, I summarized the errors I encountered while actually running Zed in my environment and what I did to solve them.
Why Unity C# doesn't work in Zed
Zed does not have standard C# support for Unity like VSCode or Rider.
Therefore,
- C# syntax parsing
- Completion
- Definition jump
- Workspace reading
cannot be done.
However, there is a language server called Omnisharp that can be installed from Zed's Extension! But... It doesn't work (at least on Windows).
I looked it up and found there was nothing I could do, so let's wait for an update regarding this Omnisharp...
So, I will change the LSP used this time to csharp-language-server and make it work.
What you need before introduction
Please introduce the following. I will describe how to introduce these somewhere else. (It's not particularly difficult, so if you search, quite a few will come up.)
- .Net runtime (9.0 upper)
- Node.js (I believe 20 upper)
- Omnisharp (Install from Zed Extension)
Download csharp-language-server
If you have cargo, use the following:
cargo install --git https://github.com/SofusA/csharp-language-serverIf you don't have it, please get the binary for Windows from Releases on the official page. The page is here Don't forget to pass the path to the stored location from environment variables.
This time I will go with the following.
C:\\Users\\<User Name>\\AppData\\Local\\csharp-language-server\\csharp-language-server.exeLink language server to Zed settings
Open Zed's Settings.json (please match which Setting.json to your environment).
{
"languages": {
"CSharp": {
"language_servers": ["omnisharp"],
"roots": ["*.sln", "*.csproj", ".git"]
}
},
"lsp": {
"omnisharp": {
"binary": {
"path": "C:\\Users\\<User Name>\\AppData\\Local\\csharp-language-server\\csharp-language-server.exe"
}
}
}
}Restart Zed and try opening a suitable .cs file. It should work just with this.
Zed's OmniSharp extension grabs old folder and causes error
Manual deletion of the csharp folder in extensions/work within the directory where Zed software is stored might solve it.
If it didn't work
- Open command palette with "Ctrl + Shift + P" on Zed.
- Get log with
zed: open log. - Throw it to AI and ask or search the error log.
Let's solve it like that;; Honestly, there are few articles, so throwing it to AI is stable.
(Zed has insane affinity with AI Agents, so that's fine too. Gemini 3.0 was released yesterday, so I'm using that^^)
Also, there are cases where LSP is running but cannot jump to definition. It seems that completion across assemblies does not work until the target file is opened. Let's open the relevant file with "Ctrl + E". Completion will start working.
Final operation feel
- Completion: Light
- Definition jump: Works without problems within the range where source exists
- External DLL: Jump is impossible (Specification, but possible for self-made DLLs)
- Not as much as Unity 100% IDE, but quite comfortable (Debugging seems impossible...)
Lighter than VSCode, simpler than Rider. Personally, I really liked it as an "editor when I want to write Unity lightly"!
Loading comments...