Skip to main content

LSP & IDE Integration

Claude Code has a dedicated LSP subsystem for code intelligence. It is separate from MCP, separate from slash commands, and only becomes active when compatible plugin-provided language servers are available.

Startup Model

🔌
Enabled plugins
📦
Load plugin LSP server configs
⚙️
LSP manager singleton
Lazy-start language servers on demand
Register passive diagnostics handlers

initializeLspServerManager() is intentionally asynchronous and non-blocking. Startup creates the manager, kicks off initialization in the background, and allows the rest of the CLI to continue.

LSP Servers Come From Plugins

The source is explicit here: LSP servers are loaded from plugins, not from user or project settings.

SourceSupported?
Plugin manifests / plugin LSP integrationYes
User settingsNo
Project settingsNo

This makes LSP part of the plugin extension surface rather than a standalone config subsystem.

What the LSP Tool Actually Does

LSPTool is a read-only built-in tool for code intelligence operations such as go-to-definition, references, hover, symbols, and call hierarchy:

BehaviorSource-Backed Detail
AvailabilityEnabled only when at least one LSP server is connected and healthy
SafetyRead-only and concurrency-safe
ValidationConfirms the path exists and is a regular file before use
Startup coordinationWaits for manager initialization if startup is still pending
ExecutionOpens the file in the LSP server before issuing requests

The tool is also marked as deferred, which matches its "specialized but optional" role in the tool system.

Passive Diagnostics

The LSP manager does more than answer direct tool calls. After successful initialization it registers passive notification handlers for diagnostics:

🧠
Language server
📣
publishDiagnostics notifications
🧰
passiveFeedback handlers
🖥️
Claude Code UI / feedback surfaces

This is why the LSP subsystem belongs in the runtime architecture, not just in the tool appendix.

Plugin Refresh Matters

reinitializeLspServerManager() exists because plugin loading can change after startup. When plugins are refreshed, Claude Code can rebuild the LSP server set instead of being stuck with the startup snapshot.

Key Source Files

FilePurpose
src/services/lsp/manager.tsLSP manager lifecycle, status, reinit, and cleanup
src/services/lsp/LSPServerManager.tsMulti-server orchestration and request routing
src/services/lsp/config.tsLoads LSP server configs from plugins only
src/services/lsp/passiveFeedback.tsPassive diagnostic notification handling
src/tools/LSPTool/LSPTool.tsRead-only LSP tool implementation