CSharpLspAdapter 1.0.2
dotnet tool install --global CSharpLspAdapter --version 1.0.2
dotnet new tool-manifest
dotnet tool install --local CSharpLspAdapter --version 1.0.2
#tool dotnet:?package=CSharpLspAdapter&version=1.0.2
nuke :add-package CSharpLspAdapter --version 1.0.2
CSharpLspAdapter
LSP adapter for csharp-ls that enables compatibility with Claude Code.
Why?
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.
Architecture
Claude Code ←→ csharp-ls-adapter ←→ csharp-ls
↓
Intercepts and handles:
- workspace/configuration
- client/registerCapability
- window/workDoneProgress/create
Installation
Quick Setup with Claude Code
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.
Prerequisites
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 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"
Manual Configuration
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
Troubleshooting
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 |
Supported LSP Features
- Go to Definition
- Find References
- Hover Documentation
- Document Symbols
- Workspace Symbols
- Diagnostics
- Code Actions
- Signature Help
- Completion
Building from Source
git clone https://github.com/agasper/CSharpLspAdapter.git
cd CSharpLspAdapter
dotnet pack -c Release
dotnet tool install --global --add-source ./bin/Release CSharpLspAdapter
Related Issues
- Claude Code #16360 — Missing LSP protocol handlers
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.