Course contentsShow
← TypeScript
Lesson 1752 of 1,79639. TypeScript PerformanceFree lesson

Restart Language Service When Stuck

When and how to restart tsserver to resolve performance issues and memory leaks in your editor.

Restart Language Service When Stuck

What you'll learn: When your TypeScript editor becomes sluggish or stops responding, knowing how to restart the language service (tsserver) can instantly restore performance without closing your entire editor.

What Is the Language Service?

TypeScript's language service (commonly called tsserver) is a background process that runs continuously in your editor. It provides autocomplete, error checking, go-to-definition, and all the other intelligent features you rely on. Like any long-running process, it can occasionally develop performance problems or memory leaks.

When to Restart

You should restart the language service when you notice:

  • Autocomplete stops working or becomes extremely slow
  • Red squiggles disappear even though errors clearly exist
  • Your editor freezes when you open TypeScript files
  • Memory usage balloons over time during a long coding session
  • Type checking seems wrong after major dependency changes

Think of it like restarting your phone when it acts glitchy—it's a quick reset that often solves mysterious problems.

How to Restart in VS Code

  1. Open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P)
  2. Type "TypeScript: Restart TS Server"
  3. Press Enter

The language service will restart in 1-2 seconds, clearing its internal caches and freeing accumulated memory. You'll see a brief notification confirming the restart.

Other Editors

  • WebStorm/IntelliJ: File → Invalidate Caches → Restart
  • Vim/Neovim: Restart your LSP client (:LspRestart in many setups)
  • Sublime Text: Restart the LSP-typescript plugin through the Command Palette

Why This Works

The language service maintains extensive in-memory caches of your project's types. Over time, especially after installing packages or switching branches, these caches can become stale or bloated. Restarting gives you a fresh state without losing your unsaved work or window layout.

Key Takeaway: When TypeScript's editor features act strangely or slow down, restarting the language service (tsserver) is a fast, non-disruptive fix that resolves most performance and correctness issues without restarting your entire editor.