summaryrefslogtreecommitdiff
path: root/cider-eldoc.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-04-03 11:41:51 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2016-04-03 11:41:51 +0300
commit3354b99797df332431045b21df96051b46bb02a6 (patch)
treeb20cc414f8a1b4e0705d81be151f77a98544ef73 /cider-eldoc.el
parent2da311e5bfb67dc6274d436926e6e0ac6d61526f (diff)
Display eldoc for keywords used to get map keys
Diffstat (limited to 'cider-eldoc.el')
-rw-r--r--cider-eldoc.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/cider-eldoc.el b/cider-eldoc.el
index 0977d85b..bfca92dd 100644
--- a/cider-eldoc.el
+++ b/cider-eldoc.el
@@ -147,8 +147,6 @@ if the maximum number of sexps to skip is exceeded."
thing
;; ignore empty strings
(not (string= thing ""))
- ;; ignore keywords
- (not (string-prefix-p ":" thing))
;; ignore strings
(not (string-prefix-p "\"" thing))
;; ignore regular expressions
@@ -158,12 +156,15 @@ if the maximum number of sexps to skip is exceeded."
;; ignore numbers
(not (string-match-p "^[0-9]" thing)))
;; check if we can used the cached eldoc info
- (if (equal thing (car cider-eldoc-last-symbol))
- (cdr cider-eldoc-last-symbol)
- (when-let ((eldoc-info (cider-sync-request:eldoc thing)))
- (let ((arglist (nrepl-dict-get eldoc-info "eldoc")))
- (setq cider-eldoc-last-symbol (cons thing arglist))
- arglist)))))
+ (cond
+ ;; handle keywords for map access
+ ((string-prefix-p ":" thing) '(("map") ("map" "not-found")))
+ (t (if (equal thing (car cider-eldoc-last-symbol))
+ (cdr cider-eldoc-last-symbol)
+ (when-let ((eldoc-info (cider-sync-request:eldoc thing)))
+ (let ((arglist (nrepl-dict-get eldoc-info "eldoc")))
+ (setq cider-eldoc-last-symbol (cons thing arglist))
+ arglist)))))))
(defun cider-eldoc ()
"Backend function for eldoc to show argument list in the echo area."