summaryrefslogtreecommitdiff
path: root/cider-eldoc.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-04-24 10:17:25 -0700
committerBozhidar Batsov <bozhidar@batsov.com>2016-04-24 10:17:25 -0700
commitfa000aad618ec60b67dbef4aea904bc75f189633 (patch)
treec7112e12b9052022ed6da96bdca6ebd86eb67997 /cider-eldoc.el
parent8a92a46b2eddb398c555daa342eb118939d54310 (diff)
Improve a bit cider-eldoc-format-thing
Diffstat (limited to 'cider-eldoc.el')
-rw-r--r--cider-eldoc.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/cider-eldoc.el b/cider-eldoc.el
index 29d540fd..b4dfcfff 100644
--- a/cider-eldoc.el
+++ b/cider-eldoc.el
@@ -63,14 +63,19 @@ For convenience, some functions are already provided for this purpose:
(defun cider-eldoc-format-thing (ns symbol thing)
"Format the eldoc subject defined by NS, SYMBOL and THING.
-Normally NS and SYMBOL are used, but when empty we fallback
-to THING (e.g. for Java methods)."
- (let ((ns (funcall cider-eldoc-ns-function ns)))
- (if (and ns (not (string= ns "")))
- (format "%s/%s"
- (cider-propertize ns 'ns)
- (cider-propertize symbol 'var))
- (cider-propertize thing 'var))))
+THING represents the thing at point which triggered eldoc. Normally NS and
+SYMBOL are used (they are derived from THING), but when empty we fallback to
+THING (e.g. for Java methods)."
+ (if (and symbol ns)
+ (let ((ns (funcall cider-eldoc-ns-function ns)))
+ (if (and ns (not (string= ns "")))
+ (format "%s/%s"
+ (cider-propertize ns 'ns)
+ (cider-propertize symbol 'var))
+ ;; in case `cider-eldoc-ns-function' returned nil or empty string
+ (cider-propertize symbol 'var)))
+ ;; we're probably dealing with some interop form
+ (cider-propertize thing 'var)))
(defun cider-highlight-args (arglist pos)
"Format the the function ARGLIST for eldoc.