corfu 好像可以,我把 corfu-auto 触发补全的函数抄过来,替换 lbcf-show,实测可以出现补全项
(setq corfu-auto nil)
(defun lsp-bridge-record-completion-items (filepath prefix common items)
(dolist (buffer (buffer-list))
(when (string-equal (buffer-file-name buffer) filepath)
(setq-local lsp-bridge-completion-items items)
(setq-local lsp-bridge-completion-prefix prefix)
(setq-local lsp-bridge-completion-common common)
;; (message "*** '%s' '%s' '%s'" prefix common items)
(cond
;; Hide completion frame if only blank before cursor.
((and (not (split-string (buffer-substring-no-properties (line-beginning-position) (point))))
(string-equal prefix ""))
(lbcf-hide))
;; Show completion frame when receive completion items.
((and (>= (length items) 1) ; items is more than one
(not (string-equal (car items) ""))) ; not empty items list
;; (lbcf-show lsp-bridge-completion-items)
(pcase (while-no-input ;; Interruptible capf query
(run-hook-wrapped 'completion-at-point-functions #'corfu--capf-wrapper))
(`(,fun ,beg ,end ,table . ,plist)
(let ((completion-in-region-mode-predicate
(lambda () (eq beg (car-safe (funcall fun)))))
(completion-extra-properties plist))
(setq completion-in-region--data
(list (if (markerp beg) beg (copy-marker beg))
(copy-marker end t)
table
(plist-get plist :predicate)))
(corfu--setup)
(corfu--update))))
)
;; Otherwise hide completion frame.
(t
(lbcf-hide))))))
(defun lsp-bridge-capf ()
(let (
(bounds (bounds-of-thing-at-point 'symbol)))
(list (car bounds) (cdr bounds)
lsp-bridge-completion-items
:exclusive 'no)))