Skip to content

Commit

Permalink
Allow lookup of function symbol when cursor is on opening paren
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan0 committed Oct 30, 2019
1 parent 760e937 commit 6bf5539
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [#2738](https://github.com/clojure-emacs/cider/pull/2738): Add ability to lookup a function symbol when cursor is at the opening paren.
* [#2735](https://github.com/clojure-emacs/cider/pull/2735): New debugger command `P` to inspect an arbitrary expression, it was previously bound to `p` which now inspects the current value.
* [#2729](https://github.com/clojure-emacs/cider/pull/2729): New cider inspector command `cider-inspector-def-current-val` lets you define a var with the current inspector value.

Expand Down
2 changes: 2 additions & 0 deletions cider-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ find a symbol if there isn't one at point."
(when look-back
(save-excursion
(ignore-errors
(when (looking-at "(")
(forward-char 1))
(while (not (looking-at "\\sw\\|\\s_\\|\\`"))
(forward-sexp -1)))
(cider-symbol-at-point)))))
Expand Down
7 changes: 7 additions & 0 deletions test/cider-util-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
(spy-on 'thing-at-point :and-return-value nil)
(expect (cider-symbol-at-point) :not :to-be-truthy)))

(describe "when on an opening paren"
(it "returns the following symbol"
(with-temp-buffer
(insert "(some function call)")
(goto-char (point-min))
(expect (cider-symbol-at-point 'look-back) :to-equal "some"))))

(it "can identify symbols in a repl, ignoring the repl prompt"
;; ignores repl prompts
(spy-on 'thing-at-point :and-return-value (propertize "user>" 'field 'cider-repl-prompt))
Expand Down

0 comments on commit 6bf5539

Please sign in to comment.