Function: dape--inlay-hint-create-overlay

dape--inlay-hint-create-overlay is a natively compiled function defined in dape.el.

Signature

(dape--inlay-hint-create-overlay)

Documentation

Create and prepare new overlay and maintain the old ones.

Source Code

;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--inlay-hint-create-overlay ()
  "Create and prepare new overlay and maintain the old ones."
  (when-let*
      ((stack-overlay dape--stack-position-overlay)
       (buffer (overlay-buffer stack-overlay))
       (overlay
        (with-current-buffer buffer
          (pcase-let ((`(,line-start . ,line-end)
                       (save-excursion
                         (goto-char (overlay-start stack-overlay))
                         (beginning-of-line)
                         (cons (point) (line-end-position)))))
            (unless (cl-find 'dape-inlay-hint
                             (overlays-in line-start line-end)
                             :key (lambda (ov) (overlay-get ov 'category)))
              (let ((overlay (make-overlay line-start line-end)))
                (overlay-put overlay 'category 'dape-inlay-hint)
                (overlay-put overlay 'evaporate t)
                (overlay-put overlay 'dape-symbols
                             (funcall dape--inlay-hint-symbols-fn
                                      line-start line-end))
                overlay))))))
    ;; Maintain the hints, keeping old ones based on value of
    ;; `dape-inlay-hints'.
    (setq dape--inlay-hint-overlays
          (cl-loop for overlay in (cons overlay dape--inlay-hint-overlays)
                   for index from 0
                   for max-overlays = (if (eq dape-inlay-hints t)
                                          2
                                        dape-inlay-hints)
                   if (< index max-overlays)
                   collect overlay
                   else do (delete-overlay overlay)))))