Getting TypeScript LSP Working in Claude Code
Claude Code is a text-based tool. Without LSP, it navigates your codebase the same way you would with grep and cat — brute-force text search, one file at a time. With LSP, it gets the same semantic understanding that powers VS Code: type-aware navigation, exact references, and automatic error detection.
The difference is dramatic:
| Capability | Without LSP | With LSP |
|---|---|---|
| Rename symbol | Grep + Edit (manual, file by file) | Find all references in one call, then edit |
| Find references | Text match (may include false positives) | Exact references from type system |
| Go to definition | Grep for function name (guesswork) | Direct jump via type graph |
| Error detection | Manual (tsc --noEmit) | Automatic after every edit |
| Token cost | High (many round-trips) | Low (fewer calls) |
| Accuracy | Best-effort text matching | Compiler-accurate |
A method rename across 20 files goes from ~25-30 tool calls (grepping, reading, editing) to a single findReferences call followed by targeted edits. The search phase collapses from many round-trips to one.
The problem
Claude Code has an official TypeScript LSP plugin: typescript-lsp@claude-plugins-official. You install it, restart, and… nothing happens. No error. No warning. The LSP tools simply do not appear.
Two things are working against you:
-
The native binary does not support it. If you installed Claude Code as a standalone binary (the default on macOS), the plugin system cannot spawn LSP child processes. The native binary bundles its own runtime that does not play well with plugins that need to run external language servers.
-
There is an undocumented feature flag. Even with the npm install, LSP tools are gated behind
ENABLE_LSP_TOOL=1. This is not mentioned in the plugin README or the Claude Code docs.
npm install vs native binary
The fix starts with how you install Claude Code itself.
The native binary bundles its own Node runtime. It works great for the core tool, but the plugin system needs to spawn child processes (like typescript-language-server), and the bundled runtime does not support this.
The npm install uses your system Node. Plugins can spawn processes normally. The two installs share the same model access and core features, but differ in meaningful ways: the native binary gets automatic background updates, while the npm version supports LSP plugins. For LSP, you need the npm version.
Note: Anthropic’s recommended install method is now the native installer (
curl -fsSL https://claude.ai/install.sh | bash). The npm install is still supported but no longer the default path. If you need LSP, the npm version is currently the only option.
If you already have the native binary installed, you can keep it as a backup and just put the npm version earlier in your PATH.
What actually works
1. Install Claude Code via npm
npm install -g @anthropic-ai/claude-code
If you already have the native binary, rename it so the npm version takes priority:
which claude
# e.g. /usr/local/bin/claude
mv /usr/local/bin/claude /usr/local/bin/claude-native-backup
2. Install the TypeScript language server
npm install -g typescript-language-server typescript
3. Set the feature flag
Add to your .zshrc (or .bashrc):
export ENABLE_LSP_TOOL=1
Or pass it inline when launching Claude Code:
ENABLE_LSP_TOOL=1 claude
4. Install the plugin
From within a Claude Code session:
/plugin install typescript-lsp@claude-plugins-official
Verify it works
Open a new terminal, navigate to a TypeScript project, and start Claude Code. Then ask it to use an LSP tool:
> Use the LSP hover tool on the main function in src/index.ts
If it responds with type information, you are set. If it says it does not have LSP tools available, double-check:
ENABLE_LSP_TOOL=1is exported in your shellwhich typescript-language-serverreturns a valid path- You are running the npm version of Claude Code, not the native binary
What you get
Once LSP is working, Claude Code gains nine new operations through a single LSP tool:
- goToDefinition — jump to where a symbol is defined, across files
- findReferences — every usage of a symbol, with compiler accuracy
- hover — type information and documentation for any symbol
- documentSymbol — list all symbols in a file (functions, classes, variables)
- workspaceSymbol — search for symbols across the entire project
- goToImplementation — find implementations of an interface or abstract method
- prepareCallHierarchy — get the call hierarchy item at a position
- incomingCalls — find all functions that call a given function
- outgoingCalls — find all functions called by a given function
These tools transform how Claude Code works with your codebase. Instead of grepping through files and hoping it finds the right match, it navigates your code the way your editor does — through the type system.
The setup is painful. The result is worth it.