Open NightMachinery opened 3 years ago
I want to display the docstring for symbols in company-counsel using ivy-rich. I don't know how I can get the docstring given a symbol though. Here is my function:
company-counsel
ivy-rich
(defun night/ivy-docstring (candidate) (let* ( (candidate-sym (intern-soft candidate)) (doc (cond ((equalp major-mode 'emacs-lisp-mode) (or (ignore-errors (helpful--docstring candidate-sym (fboundp candidate-sym)) ;; (helpful-symbol candidate-sym) ) "") ) ((equalp major-mode 'lisp-mode) ;; (sly-eval `(slynk:describe-function ,candidate)) (sly-eval `(slynk:describe-symbol ,candidate))) (t "Not implemented yet") )) (doc (s-lines doc)) (doc (s-join "; " (identity doc)))) doc))
As you see, this documentation is mostly just the arglist and not a docstring, and it's suitable only for buffers.
Here is an example of this working correctly in elisp, using helpful--docstring (which uses documentation under the hood):
elisp
helpful--docstring
documentation
I want to display the docstring for symbols in
company-counsel
usingivy-rich
. I don't know how I can get the docstring given a symbol though. Here is my function:As you see, this documentation is mostly just the arglist and not a docstring, and it's suitable only for buffers.
Here is an example of this working correctly in
elisp
, usinghelpful--docstring
(which usesdocumentation
under the hood):