eglot inlay hints make cursor movement laggy in large files while the server is busy
Symptom#
Moving the cursor in a large file (a 6,000-line C++ file) takes 40 to 125 ms per move right after the file opens, while clangd is still indexing. Bare Emacs (emacs -Q) takes about 1 ms.
Cause#
With eglot-inlay-hints-mode on, eglot asks the server for new hints as the window moves and redraws again when the answer arrives. While the server is busy, each move waits on that round trip.
Fix#
Start with inlay hints off and toggle them on demand, for example by adding :inlayHintProvider to eglot-ignored-server-capabilities, or by turning eglot-inlay-hints-mode off in eglot-managed-mode-hook, with a key to turn them back on. Measure with a timed loop of cursor moves before blaming other things such as the mode line.
Evidence#
Emacs 30 GUI on macOS with clangd, 2026-09-26: with hints on, 40 to 125 ms per move just after opening and 1.4 to 2 ms once clangd settled; with hints off, 1.3 ms per move 12 s after opening, clangd still busy. The custom status line cost about 5 of 135 profiler samples.