summaryrefslogtreecommitdiff
path: root/cider-interaction.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@tradeo.com>2014-08-06 17:44:14 +0300
committerBozhidar Batsov <bozhidar@tradeo.com>2014-08-06 17:44:41 +0300
commit35054b45b92fcd88c96fd5ce636ea62a04014e96 (patch)
treef2dceb208623d8d286c185afd7238086403d8846 /cider-interaction.el
parentaaede576f8e5fa880610556c3b85e8f66968380c (diff)
[Fix #704] Annotate completion candidates
Diffstat (limited to 'cider-interaction.el')
-rw-r--r--cider-interaction.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/cider-interaction.el b/cider-interaction.el
index d173e044..7b44832d 100644
--- a/cider-interaction.el
+++ b/cider-interaction.el
@@ -712,6 +712,16 @@ form, with symbol at point replaced by __prefix__."
(when strlst
strlst)))
+(defun cider-annotate-symbol (symbol)
+ (-when-let (info (cider-var-info symbol))
+ (let ((macro (cadr (assoc "macro" info)))
+ (special (cadr (assoc "special-form" info)))
+ (args (cadr (assoc "arglists-str" info))))
+ (cond
+ (macro " <m>")
+ (special " <s>")
+ (args " <f>")))))
+
(defun cider-complete-at-point ()
"Complete the symbol at point."
(let ((sap (symbol-at-point)))
@@ -719,6 +729,7 @@ form, with symbol at point replaced by __prefix__."
(let ((bounds (bounds-of-thing-at-point 'symbol)))
(list (car bounds) (cdr bounds)
(completion-table-dynamic #'cider-complete)
+ :annotation-function #'cider-annotate-symbol
:company-doc-buffer #'cider-create-doc-buffer
:company-location #'cider-company-location
:company-docsig #'cider-company-docsig)))))