In the specific situation of visiting a buffer via M-. with
eglot-extend-to-xref set to t, it was found that buffer was first
visited in fundamental mode, running after-change-major-mode-hook, and
then again in the proper major mode for the file. The call to
eglot-current-server of the first visit returned non-nil which cause
two didOpen notifications to be issued for the same file.
Furthermore, in the first call, eglot--languageId to returned nil,
prompting an error from servers such as rust-analyzer.
See also: https://github.com/joaotavora/eglot/discussions/1330
* lisp/progmodes/eglot.el (eglot-current-server): Watch out for
fundamental-mode.