Function: dape--config-completion-at-point
dape--config-completion-at-point is a natively compiled function
defined in dape.el.
Signature
(dape--config-completion-at-point)
Documentation
Function for completion-at-point fn for dape--read-config.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--config-completion-at-point ()
"Function for `completion-at-point' fn for `dape--read-config'."
(let (key key-end args args-bounds last-p)
(save-excursion
(goto-char (minibuffer-prompt-end))
(setq key (ignore-errors (read (current-buffer))))
(setq key-end (point))
(ignore-errors
(while t
(setq last-p (point))
(push (read (current-buffer)) args)
(push (cons last-p (point)) args-bounds))))
(setq args (nreverse args)
args-bounds (nreverse args-bounds))
(cond
;; Complete key
((<= (point) key-end)
(pcase-let ((`(,start . ,end)
(or (bounds-of-thing-at-point 'symbol)
(cons (point) (point)))))
(list start end
(mapcar (lambda (suggestion) (format "%s " suggestion))
dape--minibuffer-suggestions))))
;; Complete args
((and (not (plist-member args '-)) ;; Skip zap/dash notation
(alist-get key dape-configs)
(or (and (plistp args)
(thing-at-point 'whitespace))
(cl-loop with p = (point)
for ((start . end) _) on args-bounds by 'cddr
when (and (<= start p) (<= p end))
return t
finally return nil)))
(pcase-let ((`(,start . ,end)
(or (bounds-of-thing-at-point 'symbol)
(cons (point) (point)))))
(list start end
(cl-loop with plist = (append (alist-get key dape-configs)
'(compile nil))
for (key _) on plist by 'cddr
collect (format "%s " key)))))
(t
(list (point) (point) nil :exclusive 'no)))))