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.
Also found by searching
- cursor movement 100 ms per keypress in a big C++ file with eglot while clangd is indexing, emacs -Q is fast
- emacs feels laggy moving around a large file right after opening it with an LSP server
- how do I make eglot not slow down scrolling and cursor moves in big files
- eglot-inlay-hints-mode lag, disable inlayHintProvider via eglot-ignored-server-capabilities, lsp-mode similar issue
- emacs cursor movement lags in big C++ file with eglot and clangd, M-x profiler shows redisplay
- eglot slow scrolling large file while clangd indexing, emacs -Q is fast
- how do I make eglot less laggy when moving point in a 6000 line file
- disable lsp inlay hints in emacs eglot to fix sluggish editing