Subject: eglot: RFE: recenter buffer upon showDocument request

From: Alan Donovan <[email-masked]>
Date: Thu, 4 Apr 2024 09:17:13 -0400

In eglot 1.17, the LSP showDocument downcall opens the designated
file, moves the cursor to the designated position, and raises the
frame. One other thing it could do to make it easier to see where the
cursor is would be to recenter the buffer.

The patch below is a minimal fix; the discussion at
https://github.com/joaotavora/eglot/discussions/1382 suggests a couple
of possible refinements.

xtools$ git diff ~/.emacs.d/elpa/eglot-1.17/eglot.el{.bak,}
--- elpa/eglot-1.17/eglot.el.orig
+++ elpa/eglot-1.17/eglot.el
@@ -2460,6 +2460,7 @@ THINGS are either registrations or
unregisterations (sic)."
                ;; function, but `xref--goto-char' happens to have
                ;; exactly the semantics we want vis-a-vis widening.
                (xref--goto-char beg)
+              (recenter)
                (pulse-momentary-highlight-region beg end 'highlight)))))))
      (t (setq success :json-false)))
     `(:success ,success)))