-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Allow lookup of function symbol when cursor is on opening paren #2738
Conversation
Fine by me. Just add one unit test as well. |
c056043
to
6bf5539
Compare
Alright, added :) |
test/cider-util-tests.el
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to enable clojure-mode
. I guess we need to add some helper named with-clojure-buffer
that actually does this automatically. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just going by the other cider-symbol-at-point
tests above which don't enable clojure-mode either. Maybe because it's a text-based util that doesn't need clojure-mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behaviour of thing-at-point
is defined by the syntax table of each major mode. Some tests will pass with the default syntax table, but that's merely a coincidence. I've noticed recently we had a few incorrect tests, but I didn't have the time to update them yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see - in clojure-mode the above test for SomeRecord.
without look-back fails, because .
has a different syntax. I'll just change the expected value for that case.
11c102a
to
a2db24c
Compare
test/cider-util-tests.el
Outdated
"Execute BODY in a clojure-mode with CONTENTS | ||
|
||
CONTENTS can be a single string to be inserted before the cursor, or a cons | ||
cell of strings (BEFORE . AFTER) where the cursor is placed in between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to directly support having an (optional) |
in the string and moving the point there instead of using a cons cell. The examples would read better IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I noticed something similar exists in clojure-mode's test suites, is it appropriate for the same macro name to be here as well?
I suppose they don't conflict and there's no way to reuse a test namespace from another package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I had in mind. Unfortunately the test stuff can't be shared, so they have to be copied.
Also fixes a few tests which did not enable clojure-mode
a2db24c
to
458821e
Compare
Thanks! |
A simple DWIM addition to allow for calling
cider-doc
and related commands on a symbol when the cursor is at its opening paren. (This is a common state to be in when using structure based navigation)Eg. with the cursor at
|
, calling M-x cider-doc should bring up documentation forg
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
make test
)make lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.