Function: eglot--post-self-insert-hook

eglot--post-self-insert-hook is a byte-compiled function defined in eglot.el.gz.

Signature

(eglot--post-self-insert-hook)

Documentation

Set eglot--last-inserted-char, maybe call on-type-formatting.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot--post-self-insert-hook ()
  "Set `eglot--last-inserted-char', maybe call on-type-formatting."
  (setq eglot--last-inserted-char last-command-event)
  (let ((ot-provider (eglot-server-capable :documentOnTypeFormattingProvider)))
    (when (and ot-provider
               (ignore-errors ; github#906, some LS's send empty strings
                 (or (eq eglot--last-inserted-char
                         (seq-first (plist-get ot-provider :firstTriggerCharacter)))
                     (cl-find eglot--last-inserted-char
                              (plist-get ot-provider :moreTriggerCharacter)
                              :key #'seq-first))))
      (eglot-format (point) nil eglot--last-inserted-char))))