LSP adapter/proxy for csharp-ls that adds missing protocol handlers for Claude Code compatibility
$ dotnet add package CSharpLspAdapterLSP adapter for csharp-ls that enables compatibility with Claude Code.
Claude Code's LSP client doesn't support several protocol methods that csharp-ls requires:
workspace/configuration — server requests workspace settingsclient/registerCapability — dynamic capability registrationwindow/workDoneProgress/create — progress reportingWithout this adapter, csharp-ls hangs waiting for responses that never come.
Claude Code ←→ csharp-ls-adapter ←→ csharp-ls
↓
Intercepts and handles:
- workspace/configuration
- client/registerCapability
- window/workDoneProgress/create
If you're already using Claude Code, simply ask it to install the adapter:
Install C# LSP support following https://github.com/Agasper/CSharpLspAdapter
Claude will read these instructions and configure everything automatically.
Important: If you have the official
csharp-lsplugin installed from the Claude Code store, you must completely uninstall it first:/plugin uninstall csharp-ls
# Install csharp-ls
dotnet tool install --global csharp-ls
# Install the adapter
dotnet tool install --global CSharpLspAdapter
Troubleshooting: If csharp-ls installation fails with
Settings file 'DotnetToolSettings.xml' was not found, either update your .NET SDK to the latest version, or install an older csharp-ls version (related issue):dotnet tool install --global csharp-ls --version 0.20.0
Note: Ensure ~/.dotnet/tools is in your PATH. Add to your shell profile if needed:
export PATH="$PATH:$HOME/.dotnet/tools"
Step 1. Create the plugin structure:
# Create plugin directory
mkdir -p ~/.claude/plugins/csharp-ls-adapter/.claude-plugin
# Create plugin.json
cat > ~/.claude/plugins/csharp-ls-adapter/.claude-plugin/plugin.json << 'EOF'
{
"name": "csharp-ls-adapter",
"description": "C# language support via csharp-ls-adapter",
"version": "1.0.0"
}
EOF
# Create .lsp.json
cat > ~/.claude/plugins/csharp-ls-adapter/.lsp.json << 'EOF'
{
"csharp": {
"command": "csharp-ls-adapter",
"extensionToLanguage": {
".cs": "csharp",
".csx": "csharp"
}
}
}
EOF
Step 2. Register the plugin in a local marketplace:
# Create marketplace directory
mkdir -p ~/.claude/plugins/.claude-plugin
# Create or update marketplace.json
cat > ~/.claude/plugins/.claude-plugin/marketplace.json << 'EOF'
{
"name": "local-plugins",
"owner": { "name": "local" },
"plugins": [
{
"name": "csharp-ls-adapter",
"source": "./csharp-ls-adapter",
"description": "C# language support via csharp-ls-adapter"
}
]
}
EOF
Step 3. Add the marketplace to Claude Code settings (~/.claude/settings.json):
{
"extraKnownMarketplaces": {
"local-plugins": {
"source": {
"source": "directory",
"path": "~/.claude/plugins"
}
}
}
}
Step 4. Install the plugin in Claude Code:
/plugin install csharp-ls-adapter@local-plugins
Step 5. Enable LSP tools and restart Claude Code:
LSP support in Claude Code requires the ENABLE_LSP_TOOL environment variable.
Option A — Run with the variable:
ENABLE_LSP_TOOL=1 claude
Option B — Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export ENABLE_LSP_TOOL=1
Environment variables below are only needed for debugging, not for normal use.
Update your .lsp.json to include them:
{
"csharp": {
"command": "csharp-ls-adapter",
"extensionToLanguage": {
".cs": "csharp",
".csx": "csharp"
},
"env": {
"LSP_SOLUTION_PATH": "/path/to/your/Solution.sln",
"LSP_ADAPTER_DEBUG": "1"
}
}
}
| Environment Variable | Description |
|---|---|
LSP_SOLUTION_PATH | Explicitly specify .sln file if auto-detection fails |
LSP_ADAPTER_DEBUG | Set to 1 to enable debug logging to csharp-lsp-adapter.log in system temp directory |
git clone https://github.com/agasper/CSharpLspAdapter.git
cd CSharpLspAdapter
dotnet pack -c Release
dotnet tool install --global --add-source ./bin/Release CSharpLspAdapter
MIT