Skip to content

Commit

Permalink
Handle var-quotes on symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsutton committed May 5, 2020
1 parent 7f4d4e8 commit 6669062
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Bugs fixed

* [#2839](https://github.com/clojure-emacs/cider/pull/2839): Fix symbol-at-point on var-quoted symbols
* [#2807](https://github.com/clojure-emacs/cider/pull/2807): Fix require-repl-utils for shadow-cljs repls.

## 0.24.0 (2020-02-15)
Expand Down
7 changes: 6 additions & 1 deletion cider-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ find a symbol if there isn't one at point."
(setq str (or (ignore-errors (cider-sync-request:macroexpand "macroexpand-1" str)) "")))
(unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str)
;; Remove font-locking, prefix quotes, and trailing . from constructors like Record.
(string-remove-prefix "'" (string-remove-suffix "." (substring-no-properties str)))))
(thread-last (substring-no-properties str)
;; constructurs (Foo.)
(string-remove-suffix ".")
(string-remove-prefix "'")
;; var references (#'inc 2)
(string-remove-prefix "#'"))))
(when look-back
(save-excursion
(ignore-errors
Expand Down
5 changes: 5 additions & 0 deletions test/cider-util-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ buffer."
(with-clojure-buffer "'foo'bar"
(expect (cider-symbol-at-point) :to-equal "foo'bar"))))

(describe "when the symbol at point is var-quoted"
(it "returns the symbol without the preceding #'"
(with-clojure-buffer "#'inc"
(expect (cider-symbol-at-point) :to-equal "inc"))))

(describe "when point is on a keyword"
(it "returns the keyword along with beginning : character"
(with-clojure-buffer ":abc"
Expand Down

0 comments on commit 6669062

Please sign in to comment.