@@ -74,6 +74,16 @@ Docsets can be searched directly via `+lookup/in-docsets'."
7474; ;
7575; ;; Commands
7676
77+ (defun +lookup--consult-search (sync cb)
78+ (lambda (action )
79+ (pcase action
80+ ((pred stringp)
81+ (when-let (cands (with-current-buffer cb
82+ (dash-docs-search action)))
83+ (funcall sync 'flush )
84+ (funcall sync cands)))
85+ (_ (funcall sync action)))))
86+
7787;;;### autoload
7888(defun +lookup/in-docsets (arg &optional query docsets)
7989 " Lookup QUERY in dash DOCSETS.
@@ -92,10 +102,26 @@ installed with `dash-docs-install-docset'."
92102 (cl-remove-if-not #'dash-docs-docset-path (or docsets dash-docs-docsets))))
93103 (query (doom-thing-at-point-or-region query)))
94104 (doom-log " Searching docsets %s" dash-docs-docsets)
95- (cond ((featurep! :completion helm)
96- (helm-dash query))
105+ (cond ((featurep! :completion vertico)
106+ (dash-docs-initialize-debugging-buffer)
107+ (dash-docs-create-buffer-connections)
108+ (dash-docs-create-common-connections)
109+ (let ((sink
110+ (thread-first (consult--async-sink)
111+ (consult--async-refresh-immediate)
112+ (+lookup--consult-search (current-buffer ))
113+ (consult--async-throttle)))
114+ (result
115+ (or (consult--read sink
116+ :prompt " Documentation for: "
117+ :category 'dash
118+ :initial query)
119+ (user-error " Aborted" ))))
120+ (dash-docs-browse-url (cdr (assoc result (funcall sink nil ))))))
97121 ((featurep! :completion ivy)
98122 (counsel-dash query))
123+ ((featurep! :completion helm)
124+ (helm-dash query))
99125 ((user-error " No dash backend is installed, enable ivy or helm." )))))
100126
101127;;;### autoload
0 commit comments