install-lsp
Install and configure LSP (Language Server Protocol) for Claude Code to enable go-to-definition, find-references, and real-time diagnostics
What this skill does
# Install LSP for Claude Code
Enable Language Server Protocol integration to give Claude Code IDE-like code intelligence: go-to-definition, find-references, rename-symbol, and real-time diagnostics.
## Why LSP?
LSP provides semantic code understanding instead of text-based grep searches:
- **50ms** to find function call sites with LSP vs **45 seconds** with text search
- Exact symbol locations with line/column numbers
- Cross-file navigation and refactoring support
## Setup Options
### Option 1: Native LSP Tool (Recommended)
Claude Code has built-in LSP support that requires activation.
**Enable permanently** (add to `~/.zshrc` or `~/.bashrc`):
```bash
export ENABLE_LSP_TOOL=1
```
**Install language plugins** from the community marketplace:
```bash
# Add the LSP plugin marketplace
/plugin marketplace add boostvolt/claude-code-lsps
# Install language-specific plugins
/plugin install pyright@claude-code-lsps # Python
/plugin install vtsls@claude-code-lsps # TypeScript/JavaScript
/plugin install gopls@claude-code-lsps # Go
/plugin install rust-analyzer@claude-code-lsps # Rust
/plugin install clangd@claude-code-lsps # C/C++
/plugin install jdtls@claude-code-lsps # Java
/plugin install omnisharp@claude-code-lsps # C#
/plugin install intelephense@claude-code-lsps # PHP
/plugin install kotlin-language-server@claude-code-lsps # Kotlin
/plugin install solargraph@claude-code-lsps # Ruby
/plugin install vscode-html-css@claude-code-lsps # HTML/CSS
```
### Option 2: cclsp MCP Server
Community MCP server with interactive setup wizard.
**Automated setup**:
```bash
npx cclsp@latest setup # Project-level config
npx cclsp@latest setup --user # User-wide config
```
The wizard:
1. Scans project files to detect languages
2. Pre-selects appropriate LSP servers
3. Shows installation instructions for each server
4. Optionally auto-installs LSP binaries
5. Configures MCP integration
## LSP Server Requirements by Language
| Language | Binary | Installation |
|----------|--------|--------------|
| **Python** | pyright | `pip install pyright` or `npm i -g pyright` |
| **TypeScript/JS** | vtsls | `npm i -g @vtsls/language-server typescript` |
| **Go** | gopls | `go install golang.org/x/tools/gopls@latest` |
| **Rust** | rust-analyzer | `rustup component add rust-analyzer` |
| **C/C++** | clangd | `brew install llvm` or `xcode-select --install` |
| **Java** | jdtls | `brew install jdtls` (requires Java 21+) |
| **C#** | omnisharp | `brew install omnisharp/omnisharp-roslyn/omnisharp-mono` |
| **PHP** | intelephense | `npm i -g intelephense` |
| **Kotlin** | kotlin-language-server | `brew install kotlin-language-server` |
| **Ruby** | solargraph | `gem install solargraph` |
| **HTML/CSS** | vscode-langservers | `npm i -g vscode-langservers-extracted` |
## cclsp Configuration File
Location: `.claude/cclsp.json` (project) or `~/.config/claude/cclsp.json` (global)
```json
{
"servers": [
{
"extensions": ["py", "pyi"],
"command": ["pyright-langserver", "--stdio"],
"rootDir": ".",
"restartInterval": 30
},
{
"extensions": ["ts", "tsx", "js", "jsx"],
"command": ["typescript-language-server", "--stdio"],
"rootDir": "."
}
]
}
```
## Available LSP Tools
After setup, Claude Code gains these capabilities:
| Tool | Description |
|------|-------------|
| `find_definition` | Navigate to symbol definition |
| `find_references` | Find all usages of a symbol |
| `rename_symbol` | Rename symbol across all files |
| `get_diagnostics` | Get type errors and warnings |
| `restart_server` | Restart the language server |
## Troubleshooting
### "No LSP server available for file type"
```bash
# Verify plugin is installed
/plugin
# Reinstall if needed
/plugin uninstall pyright@claude-code-lsps
/plugin install pyright@claude-code-lsps
```
### "Executable not found in $PATH"
```bash
# Check binary exists
which pyright
which gopls
# For Go, ensure GOPATH/bin is in PATH
export PATH=$PATH:$(go env GOPATH)/bin
```
### Plugin installed but inactive
```bash
# Clear cache and reinstall
rm -rf ~/.claude/plugins/cache
/plugin install pyright@claude-code-lsps
```
### Windows Users
Use `cmd /c` wrapper for cclsp:
```json
{
"servers": [{
"extensions": ["py"],
"command": ["cmd", "/c", "pyright-langserver", "--stdio"]
}]
}
```
## Verification
After setup, test by asking Claude Code to:
- "Go to definition of `functionName`"
- "Find all references to `ClassName`"
- "Show diagnostics for this file"
A working setup provides exact file:line locations instead of grep-based text search results.
## Best Practice
Combine LSP with traditional search:
- **Use LSP** for: go-to-definition, diagnostics, rename
- **Use Grep** for: find all usages, text patterns, comments
LSP provides precision; Grep provides coverage.
## Execution Instructions
When the user runs this command:
1. **Determine approach** from arguments:
- `native` - Use built-in LSP tool with plugins
- `cclsp` - Use cclsp MCP server
- No argument - Ask user which approach they prefer
2. **For native approach**:
- Check if `ENABLE_LSP_TOOL` is already set
- Add marketplace if not present
- Install requested language plugin(s)
- Verify with `/plugin` command
3. **For cclsp approach**:
- Run `npx cclsp@latest setup` interactively
- Guide user through language server installation
- Verify MCP server is added with `/mcp`
4. **Inform user** to restart Claude Code after installation
## Sources
- [cclsp GitHub](https://github.com/ktnyt/cclsp)
- [Claude Code LSP Setup Guide](https://www.aifreeapi.com/en/posts/claude-code-lsp)
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.