Language Server Protocol (LSP)
The Language Server Protocol (LSP) is an open, JSON-RPC-based protocol for communication between code editors and language servers. Originally developed by Microsoft for VS Code, it has since become an industry standard.
Claude Code natively supports LSP, giving Claude the same intelligent code capabilities as a professional IDE while processing your code.
What Does LSP Bring to Claude Code?
Through LSP integration, Claude gains the following capabilities:
| Feature | Description |
|---|---|
| Real-time diagnostics | Claude sees errors and warnings immediately after every edit |
| Go to definition | Quickly locate where a function, variable, or class is defined |
| Find references | Find all usages of a code symbol across the project |
| Hover information | Get type information and documentation comments |
| Language awareness | Understand the type and context of code symbols |
LSP is a native plugin feature of Claude Code — it does not depend on VS Code or any other IDE. You can use Claude Code independently in a terminal and enjoy full code intelligence support.
How It Works
┌─────────────────┐ LSP Protocol ┌──────────────────────┐
│ Claude Code │ ◄──────────────────► │ Language Server │
│ (client) │ JSON-RPC │ (e.g. typescript- │
│ │ │ language-server) │
└─────────────────┘ └──────────────────────┘
│ │
│ │
▼ ▼
Sends code action requests Analyzes code and returns results
(go to definition, find references…) (locations, types, errors…)Once you install and enable an LSP plugin:
- On startup: Claude Code automatically starts the language servers configured in installed plugins
- On edit: The language server analyzes your code in real time after every file change
- Diagnostics: Errors and warnings are automatically fed back to Claude
- Navigation: Claude can use go-to-definition, find-references, and other operations
Installing LSP Plugins
Install from the Official Marketplace (Recommended)
The easiest approach is to install from the official plugin marketplace:
# Run inside Claude Code
/plugin
# Then select the Discover tab and search for "lsp"Officially Supported LSP Plugins
| Plugin | Language Server | Installation |
|---|---|---|
pyright-lsp | Pyright (Python) | pip install pyright or npm install -g pyright |
typescript-lsp | TypeScript Language Server | npm install -g typescript-language-server typescript |
rust-lsp | rust-analyzer | See installation guide |
LSP plugins are configuration files only — they do not include the language server binary itself. You must install the corresponding language server first, then install the plugin.
LSP Plugin Configuration Format
If the official marketplace doesn’t have the language you need, you can create your own LSP plugin.
Configuration File Location
- Standalone file:
.lsp.jsonin the plugin root directory - Inline configuration: in the
lspServersfield ofplugin.json
Configuration Example
{
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".ts": "typescript",
".tsx": "typescriptreact",
".js": "javascript",
".jsx": "javascriptreact"
}
}
}Required Fields
| Field | Description |
|---|---|
command | LSP binary name (must be on your PATH) |
extensionToLanguage | Mapping of file extensions to language identifiers |
Optional Fields
| Field | Description |
|---|---|
args | Command-line arguments for starting the language server |
transport | Communication mode: stdio (default) or socket |
env | Environment variables to set when starting the server |
initializationOptions | Options passed to the server during initialization |
settings | Settings sent via workspace/didChangeConfiguration |
workspaceFolder | Workspace folder path |
startupTimeout | Maximum time to wait for server startup (milliseconds) |
shutdownTimeout | Maximum time to wait for graceful shutdown (milliseconds) |
restartOnCrash | Whether to automatically restart the server on crash |
maxRestarts | Maximum restart attempts before giving up |
loggingConfig | Debug logging configuration |
Debugging LSP Issues
If you encounter LSP-related problems, enable verbose logging:
claude --enable-lsp-loggingLog files are located in the ~/.claude/debug/ directory.
Common Issues
“Executable not found in $PATH”
The language server is not installed or is not on your system PATH. Install the corresponding language server first.
“No LSP server available for file type”
No LSP plugin is configured for that file type. Check that the plugin is correctly installed and that extensionToLanguage includes the extension in question.
Available LSP Plugins
Reference Resources
- Claude Code Official Plugin Documentation
- boostvolt/claude-code-lsps — Community-maintained LSP plugin collection
- Language Server Protocol Official Specification