Skip to main content
The 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

The server communicates via stdin/stdout using JSON messages.

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

--globalPlugins
string
Comma-separated list of global TypeScript plugins to load.
--pluginProbeLocations
string
Comma-separated list of additional locations to probe for plugins.
--allowLocalPluginLoads
boolean
default:"false"
Allow loading plugins from local node_modules.

Project Options

--useSingleInferredProject
boolean
default:"false"
Use a single inferred project for all files.
--useInferredProjectPerProjectRoot
boolean
default:"false"
Use an inferred project per project root.

Diagnostic Options

--suppressDiagnosticEvents
boolean
default:"false"
Suppress diagnostic events from being sent to the client.
--noGetErrOnBackgroundUpdate
boolean
default:"false"
Don’t send getErr events on background updates.

Watch Options

--canUseWatchEvents
boolean
default:"false"
Enable file system watcher events.

Logging Options

--logFile
string
Path to log file for debugging.
--logVerbosity
string
default:"normal"
Set logging verbosity level.Valid values: terse, normal, verbose

Protocol 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:
Response:

completions

Get auto-completion suggestions:
Response:

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:
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

Sample Log:

Performance Tuning

Use --suppressDiagnosticEvents to reduce message overhead in large projects.
Configure skipLibCheck: true in tsconfig.json to speed up type checking.
Use project references for monorepos to improve incremental checking performance.

Common Issues

High CPU usageCheck for circular dependencies or very large union types. Enable logging to diagnose.
Stale completionsEnsure the editor is sending change events when files are modified.
Plugin not loadingVerify plugin path and use --allowLocalPluginLoads if loading from node_modules.

Source Code Reference

The TypeScript language server implementation:
The tsserver binary (bin/tsserver) is a wrapper that loads the compiled server from lib/tsserver.js.