• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

How do red squiggles appear instantly after typing a type error?

Formal Definition

Per Wikipedia: “LSP diagnostics are push notifications publishDiagnostics that server sends when files change, carrying errors and warnings with ranges.”

Explanation

Server is proofreader — as you type it marks mistakes and sends sticky notes with line numbers.

How It Works

  1. Buffer changes send didChange
  2. Server re-analyzes file
  3. Server sends publishDiagnostics
  4. Client renders virtual text and signs
  5. User jumps via diagnostic list

Visual Explanation

lsp_diagnostics A Edit B Analysis A->B step 1 C Squiggles B->C step 2

Semantic Network

semantic_lsp_diagnostics THIS LSP Diagnostics REL1 Related THIS--REL1 related REL2 Prereq THIS--REL2 builds from

Key Properties

  • Push not pull — server decides when
  • Ranges map to buffer lines
  • Clear on fix — server resends empty

Real-World Example

vim.diagnostic.config({virtual_text=true})

Connections

Edge Cases & Gotchas

  • Flooding — large file sends many diagnostics throttles UI
  • Stale diagnostics after server crash