When Eglot is turned on, it arranges for turning itself off automatically if the language server process terminates. Turning off Eglot means that it shuts down the server connection, ceases its management of all the buffers that use the server connection which was terminated, deactivates its minor mode, and restores the original values of the Emacs variables that Eglot changed when it was turned on. See Buffers, Projects, and Eglot, for more details of what Eglot management of a buffer entails.
You can also shut down a language server manually, by using the command M-x eglot-shutdown. This prompts for the server (unless there’s only one connection and it’s used in the current buffer), and then shuts it down. By default, it also kills the server’s events buffer (see Troubleshooting Eglot), but a prefix argument prevents that.
Alternatively, you can customize the variable
eglot-autoshutdown
to a non-nil
value, in which case
Eglot will automatically shut down the language server process when
the last buffer served by that language server is killed. The default
of this variable is nil
, so that visiting another file would
automatically activate Eglot even when the project which started Eglot
with the server no longer has any buffer associated with it. This
default allows you to start a server only once in each Emacs session.