(interactive (list (eglot--current-server-or-lose)))
(jsonrpc-forget-pending-continuations server))
-(defvar eglot-connect-hook nil "Hook run after connecting in `eglot--connect'.")
+(defvar eglot-connect-hook
+ '(eglot-signal-didChangeConfiguration)
+ "Hook run after connecting in `eglot--connect'.")
(defvar eglot-server-initialized-hook
- '(eglot-signal-didChangeConfiguration)
- "Hook run after server is successfully initialized.
+ '()
+ "Hook run after a `eglot-lsp-server' instance is created.
+
+That is before a connection was established. Use
+`eglot-connect-hook' to hook into when a connection was
+successfully established and the server on the other side has
+received the initializing configuration.
+
Each function is passed the server as an argument")
(defun eglot--connect (managed-major-mode project class contact)
(setf (eglot--project-nickname server) nickname)
(setf (eglot--major-mode server) managed-major-mode)
(setf (eglot--inferior-process server) autostart-inferior-process)
+ (run-hook-with-args 'eglot-server-initialized-hook server)
;; Now start the handshake. To honour `eglot-sync-connect'
;; maybe-sync-maybe-async semantics we use `jsonrpc-async-request'
;; and mimic most of `jsonrpc-request'.
(let ((default-directory (car (project-roots project)))
(major-mode managed-major-mode))
(hack-dir-local-variables-non-file-buffer)
- (run-hook-with-args 'eglot-connect-hook server)
- (run-hook-with-args 'eglot-server-initialized-hook server))
+ (run-hook-with-args 'eglot-connect-hook server))
(eglot--message
"Connected! Server `%s' now managing `%s' buffers \
in project `%s'."