Skip to content

How to Configure LSP in Claude Code: A Step-by-Step Guide

Problem

I was working in Claude Code and noticed something missing. No autocomplete. No go-to-definition. No real-time error checking.

When I edited a TypeScript file and made a typo, Claude Code didn’t catch it. When I wanted to jump to a function definition, I couldn’t. The code intelligence I took for granted in VS Code simply wasn’t there.

Here’s what I experienced:

Missing Features
- No autocomplete suggestions
- No go-to-definition (F12 equivalent)
- No real-time type checking
- No find-references support
- Higher token usage from lack of context

I assumed Claude Code just didn’t support these features. I was wrong.

Discovery

I found a Reddit discussion where someone mentioned:

“No LSP configured out-of-the-box, have to install and wire it up yourself. I see most Claude Code users don’t know this yet, but this increases code quality, reduces errors and save you several tokens at the end of the day.”

LSP stands for Language Server Protocol. It’s the technology that powers code intelligence in modern editors. VS Code uses it. Neovim uses it. And Claude Code supports it too - but it requires manual setup.

The Two-Step Process

Claude Code offers official LSP plugins for 11 languages. But here’s the key insight I missed initially: the plugin is not enough. You need two things:

  1. The language server installed on your system
  2. The LSP plugin installed in Claude Code

I tried skipping step 1. It didn’t work.

What I Did Wrong
# In Claude Code:
/plugin install typescript-lsp
# Result: Nothing happened
# Reason: No language server was installed

Let me show you the correct process.

Step 1: Install the Language Server

First, install the language server for your programming language. Here are the commands for each supported language:

TypeScript/JavaScript:

Install TypeScript Language Server
npm install -g typescript-language-server typescript

Python:

Install Pyright
# Using npm
npm install -g pyright
# Using pip (alternative)
pip install pyright
# Using pipx (recommended for CLI tools)
pipx install pyright

Go:

Install gopls
go install golang.org/x/tools/gopls@latest

Rust:

Install rust-analyzer
# Via rustup (recommended)
rustup component add rust-analyzer
# Via Homebrew (macOS)
brew install rust-analyzer

Swift (macOS):

Install SourceKit-LSP
# SourceKit-LSP comes with Xcode
# Or install via Homebrew
brew install swift

After installation, verify the language server is in your PATH:

Verify Installation
# TypeScript
typescript-language-server --version
# Python
pyright --version
# Go
gopls version
# Rust
rust-analyzer --version

If any of these commands fail, the language server isn’t installed correctly. Fix that before moving to step 2.

Step 2: Install the LSP Plugin

Once the language server is working, install the corresponding plugin in Claude Code:

Plugin Installation in Claude Code
# TypeScript/JavaScript
/plugin install typescript-lsp
# Python
/plugin install pyright-lsp
# Go
/plugin install gopls-lsp
# Rust
/plugin install rust-analyzer-lsp
# C/C++
/plugin install clangd-lsp
# Java
/plugin install jdtls-lsp
# Kotlin
/plugin install kotlin-lsp
# Swift
/plugin install swift-lsp
# C#
/plugin install csharp-lsp
# PHP
/plugin install php-lsp
# Lua
/plugin install lua-lsp

Step 3: Verify the Setup

After installing both the language server and plugin, verify everything works:

Check Plugin Status
# List installed plugins
/plugin list
# View specific plugin details
/plugin info typescript-lsp

Here’s a reference table of all supported languages:

LSP Plugin Reference
┌─────────────────────┬──────────────────────┬───────────────────────────┐
│ Language │ Plugin Name │ Language Server │
├─────────────────────┼──────────────────────┼───────────────────────────┤
│ TypeScript/JS │ typescript-lsp │ typescript-language-server│
│ Python │ pyright-lsp │ pyright │
│ Go │ gopls-lsp │ gopls │
│ Rust │ rust-analyzer-lsp │ rust-analyzer │
│ C/C++ │ clangd-lsp │ clangd │
│ Java │ jdtls-lsp │ jdtls │
│ Kotlin │ kotlin-lsp │ kotlin-language-server │
│ Swift │ swift-lsp │ sourcekit-lsp │
│ C# │ csharp-lsp │ OmniSharp │
│ PHP │ php-lsp │ intelephense │
│ Lua │ lua-lsp │ lua-language-server │
└─────────────────────┴──────────────────────┴───────────────────────────┘

Why This Matters

After setting up LSP, I noticed immediate improvements:

1. Reduced Token Usage

LSP provides context-aware suggestions. Claude doesn’t have to guess as much. This saves tokens on every interaction.

2. Fewer Errors

Real-time type checking catches issues before code execution. I see typos and type mismatches immediately.

3. Better Navigation

Go-to-definition and find-references work. I can explore codebases faster.

4. Improved Code Quality

Static analysis catches potential bugs early. I write better code because I get immediate feedback.

Common Mistakes

I made several mistakes during setup. Here’s what I learned:

Mistake 1: Installing only the plugin

Plugin Without Language Server
# This alone does nothing
/plugin install typescript-lsp

The plugin is a bridge between Claude Code and the language server. Without the language server, the bridge leads nowhere.

Mistake 2: Not verifying PATH

I installed the language server but couldn’t access it because my PATH wasn’t set correctly. Always test with the --version command.

Mistake 3: Installing all LSPs

I got excited and installed every LSP plugin. This consumed unnecessary resources. Only install what you need for your active projects.

Mistake 4: Forgetting to restart

Some LSP plugins require a Claude Code restart to fully activate. If things don’t work immediately, try restarting.

Complete Example: TypeScript Setup

Here’s my complete TypeScript LSP setup process:

Complete TypeScript LSP Setup
# 1. Install the language server globally
npm install -g typescript-language-server typescript
# 2. Verify installation
typescript-language-server --version
# Output: 4.3.3 (or your version)
# 3. In Claude Code session, install the plugin
/plugin install typescript-lsp
# 4. Verify plugin is active
/plugin list
# 5. Test by opening a .ts file and checking for:
# - Autocomplete suggestions
# - Error squiggles for type errors
# - Go-to-definition working

Summary

Configuring LSP in Claude Code requires two steps: installing the language server on your system, then installing the corresponding plugin. The setup takes only a few minutes but provides significant benefits in code intelligence, error reduction, and token efficiency.

The key insight is that most Claude Code users don’t know LSP support exists because it’s not enabled by default. Once configured, you get the same code intelligence features you’d expect from a traditional IDE.

For multi-language projects, install only the LSP plugins you actively need. Each running language server consumes resources, so be selective.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments