Skip to content

Commit fd1f62e

Browse files
committed
[Fix #2721] Handle properly symbols ending in . (e.g. SomeRecord.)
Now `cider-symbol-at-point` simply rejects the trailing dot.
1 parent 6f0f25b commit fd1f62e

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [#2705](https://github.com/clojure-emacs/cider/issues/2705): Middleware version check looks at only at the minor version for comparison (when the major version is 0) and ensures a matching major and a minor >= required otherwise.
1818
* Fixed some bugs related to the new suitable-powered ClojureScript code completion (this was fixed by upgrading the `suitable` used by `cider-nrepl`).
1919
* Remove a misplaced error message when doing `clojuredocs-lookup`.
20+
* [#2721](https://github.com/clojure-emacs/cider/issues/2721): Handle properly symbols ending in `.` (e.g. `SomeRecord.`).
2021

2122
## 0.22.0 (2019-09-01)
2223

cider-util.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ Ignores the REPL prompt. If LOOK-BACK is non-nil, move backwards trying to
129129
find a symbol if there isn't one at point."
130130
(or (when-let* ((str (thing-at-point 'symbol)))
131131
(unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str)
132-
(substring-no-properties str)))
132+
;; Remove font-locking and trailing . from constructors like Record.
133+
(string-trim-right (substring-no-properties str) "\\.")))
133134
(when look-back
134135
(save-excursion
135136
(ignore-errors

test/cider-util-tests.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@
8585
(expect (cider-symbol-at-point) :not :to-be-truthy)
8686
(expect (cider-symbol-at-point 'look-back) :to-equal "some-symbol"))))
8787

88+
(describe "when the symbol at point has a trailing ."
89+
(it "returns the symbol without the ."
90+
(with-temp-buffer
91+
(insert "SomeRecord.")
92+
(expect (cider-symbol-at-point) :not :to-be-truthy)
93+
(expect (cider-symbol-at-point 'look-back) :to-equal "SomeRecord"))))
94+
8895
(describe "when there's nothing at point"
8996
(it "returns nil"
9097
(spy-on 'thing-at-point :and-return-value nil)

0 commit comments

Comments
 (0)