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 d47c0e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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 d47c0e1

Please sign in to comment.