A Zed editor extension providing C# language support via OmniSharp-Roslyn and netcoredbg debugger.
- Code completion, go-to-definition, find references, rename symbol
- Diagnostics and code analysis
- Solution file detection (.sln, .slnx, .slnf)
- MSBuild integration
- Unity project support - automatic detection and configuration
- Debugging support via netcoredbg
- Auto-downloads OmniSharp-Roslyn and netcoredbg on first use
- Supports custom OmniSharp installations via PATH
- Go-to-definition on BCL (Base Class Library) types currently not working
- Some cross-project navigation may be limited
This extension is currently in development and not available in the Zed extension registry.
To install:
- Clone this repository
- Open Zed and run:
zed: extensions: install dev extension - Select the cloned
csharp_roslyndirectory - Restart Zed
The extension works out of the box! Simply open a C# project with a .sln file and start coding.
For Unity projects, see Unity Support Guide for setup instructions.
Quick start:
- Generate project files in Unity:
Edit → Preferences → External Script Editor→ "Regenerate project files" - Open Unity project folder in Zed
- Extension automatically detects Unity projects and configures OmniSharp appropriately
If auto-detection doesn't find your solution file, specify it in your Zed settings (Cmd+, / Ctrl+,):
{
"language_servers": {
"omnisharp-roslyn": {
"initialization_options": {
"solution": "/absolute/path/to/your/solution.sln"
}
}
}
}{
"language_servers": {
"omnisharp-roslyn": {
"enabled": true,
"initialization_options": {
"solution": "/absolute/path/to/your/solution.sln"
}
}
}
}The extension supports automatic debug configuration generation from tasks or manual configuration.
Create .zed/tasks.json in your project root:
[
{
"label": "Run MyApp",
"command": "dotnet",
"args": ["run", "--project", "src/MyApp/MyApp.csproj"],
"use_new_terminal": false
},
{
"label": "Build MyApp",
"command": "dotnet",
"args": ["build", "src/MyApp/MyApp.csproj"],
"use_new_terminal": false
}
]The extension automatically generates debug configurations from your dotnet run tasks. Simply select the task from the debug panel and start debugging!
Create .zed/debug.json in your project root:
[
{
"label": "Debug MyApp",
"adapter": "netcoredbg",
"request": "launch",
"program": "$ZED_WORKTREE_ROOT/src/MyApp/bin/Debug/{targetFramework}/MyApp.dll",
"args": [],
"cwd": "$ZED_WORKTREE_ROOT",
"stopAtEntry": false,
"console": "internalConsole"
}
]Note: The {targetFramework} placeholder (e.g., net8.0, net9.0) is automatically detected from your .csproj file at debug time.
program: Path to the .NET DLL to debug (use$ZED_WORKTREE_ROOTfor workspace root)args: Array of command-line argumentscwd: Working directoryenv: Environment variables objectstopAtEntry: Break at program entry point (default: false)console:"internalConsole","integratedTerminal", or"externalTerminal"
{
"label": "Debug with Args",
"adapter": "netcoredbg",
"request": "launch",
"program": "$ZED_WORKTREE_ROOT/bin/Debug/{targetFramework}/MyApp.dll",
"args": ["--verbose", "input.txt"],
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"cwd": "$ZED_WORKTREE_ROOT"
}For detailed troubleshooting information, enable debug logging in your Zed settings:
{
"lsp": {
"csharp_roslyn": {
"initialization_options": {
"enable_debug_logging": true
}
}
}
}Debug messages appear in the terminal when running Zed with zed . --foreground. Extension logs do not appear in Zed's main log file due to WASM sandbox limitations.
Messages are prefixed with [csharp_roslyn] and show:
- Unity project detection status
- Solution file discovery attempts
- OmniSharp download progress
- Debugger setup steps
- Configuration decisions
- Extension auto-downloads OmniSharp-Roslyn on first use
- Cache location:
~/.cache/zed/extensions/csharp_roslyn/cache/(Linux/macOS) or%LOCALAPPDATA%\Zed\extensions\csharp_roslyn\cache\(Windows) - Enable debug logging (above) for detailed diagnostics
- Check terminal output when running with
zed . --foregroundfor debug messages - Manually download from: https://github.com/OmniSharp/omnisharp-roslyn/releases
- Extension auto-downloads netcoredbg on first use
- Verify
programpath exists and build completed successfully - Ensure Debug configuration (not Release)
- Enable debug logging (above) for detailed diagnostics
- Check logs:
Help → View Logs
- Place
.slnfile in workspace root, or - Manually specify solution path in settings (see Setup section above)
cargo build --target wasm32-wasip2 --releasecp target/wasm32-wasip2/release/csharp_roslyn.wasm ~/Library/Application\ Support/Zed/extensions/installed/csharp_roslyn/extension.wasmMIT License
- OmniSharp-Roslyn: https://github.com/OmniSharp/omnisharp-roslyn
- netcoredbg: https://github.com/Samsung/netcoredbg
- Issues: https://github.com/marcptrs/csharp-roslyn/issues