LSP 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 reporting
Without 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
- .NET SDK 8.0 or later
- csharp-ls language server
# Install csharp-ls
dotnet tool install --global csharp-ls
# Install the adapter
dotnet tool install --global CSharpLspAdapterTroubleshooting: 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 .NET tools directory is in your PATH:
- macOS/Linux: Add to
~/.bashrcor~/.zshrc:export PATH="$PATH:$HOME/.dotnet/tools"
- Windows: Add
%USERPROFILE%\.dotnet\toolsto your PATH environment variable
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"
}
}
}
EOFStep 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"
}
]
}
EOFStep 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.
macOS/Linux — Add this line to your ~/.bashrc or ~/.zshrc file:
export ENABLE_LSP_TOOL=1Then restart your terminal or run source ~/.zshrc.
Windows — Add ENABLE_LSP_TOOL with value 1 to your user environment variables (System Properties → Environment Variables), then restart Claude Code.
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 |
- Go to Definition
- Find References
- Hover Documentation
- Document Symbols
- Workspace Symbols
- Diagnostics
- Code Actions
- Signature Help
- Completion
git clone https://github.com/agasper/CSharpLspAdapter.git
cd CSharpLspAdapter
dotnet pack -c Release
dotnet tool install --global --add-source ./bin/Release CSharpLspAdapter- Claude Code #16360 — Missing LSP protocol handlers
MIT