Make cider completion work with corfu

This commit is contained in:
David Morgan 2022-12-05 12:24:06 +00:00
parent c3ad45ac28
commit 8de452cf89
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 14 additions and 0 deletions

View File

@ -135,6 +135,20 @@
(unbind-key "C-c C-l" cider-mode-map)
(unbind-key "C-c C-b" cider-mode-map)
(unbind-key "C-c C-b" cider-repl-mode-map)
;; https://github.com/clojure-emacs/cider/issues/3019#issuecomment-1330342147
(defun my/cider-complete-at-point ()
"Complete the symbol at point."
(when (and (cider-connected-p)
(not (cider-in-string-p)))
(when-let* ((bounds (bounds-of-thing-at-point 'symbol))
(beg (car bounds))
(end (cdr bounds))
(completion (append (cider-complete (buffer-substring beg end))
(get-text-property (point) 'cider-locals))))
(list beg end (completion-table-dynamic (lambda (_) completion))
:annotation-function #'cider-annotate-symbol))))
(advice-add 'cider-complete-at-point :override 'my/cider-complete-at-point)
:bind
(:map cider-mode-map
("C-c M-l" . cider-load-file)