tsserver command starts the TypeScript language server, which provides editor services like auto-completion, type checking, and refactoring.
tsserver is typically used by editors and IDEs, not directly by developers. This documentation is for tool authors and advanced users.Installation
Basic Usage
How Editors Use tsserver
Editors like VS Code, Vim, and Sublime Text integrate with tsserver to provide:- Auto-completion
- Type information on hover
- Error diagnostics
- Go to definition
- Find references
- Refactoring
Command-Line Options
Plugin Options
Comma-separated list of global TypeScript plugins to load.
Comma-separated list of additional locations to probe for plugins.
Allow loading plugins from local node_modules.
Project Options
Use a single inferred project for all files.
Use an inferred project per project root.
Diagnostic Options
Suppress diagnostic events from being sent to the client.
Don’t send getErr events on background updates.
Watch Options
Enable file system watcher events.
Logging Options
Path to log file for debugging.
Set logging verbosity level.Valid values:
terse, normal, verboseProtocol Overview
tsserver uses a JSON-based request/response protocol over stdin/stdout.Request Format
Response Format
Common Commands
open
Open a file for editing:quickinfo
Get type information at a position:completions
Get auto-completion suggestions:definition
Go to definition:references
Find all references:rename
Rename a symbol:geterr
Get diagnostic errors:Event Messages
tsserver sends event messages for background operations:semanticDiag
projectLoadingFinish
Server Modes
tsserver can run in different modes optimized for different scenarios:- Semantic Mode (Default)
- Syntactic Mode
- Partial Semantic Mode
Full language service with type checking and all features.
Configuration via tsconfig.json
tsserver respects compiler options and plugin configuration from tsconfig.json:tsconfig.json
Editor Integration Examples
VS Code
VS Code uses tsserver internally via the TypeScript extension:settings.json
Vim with coc.nvim
coc-settings.json
Neovim with nvim-lspconfig
init.lua
Debugging tsserver
Enable Logging
Inspect Log Output
Performance Tuning
Common Issues
Source Code Reference
The TypeScript language server implementation:- Main entry point:
src/tsserver/server.ts:57 - Session handler:
src/server/session.ts - Protocol definitions:
src/server/protocol.ts - Editor services:
src/server/editorServices.ts
The
tsserver binary (bin/tsserver) is a wrapper that loads the compiled server from lib/tsserver.js.Related Documentation
- Compiler Options - Detailed compiler option reference
- tsc Command - TypeScript compiler CLI reference
- TypeScript Handbook - Official TypeScript documentation