Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle var-quotes on symbols #2839

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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