-
-
Notifications
You must be signed in to change notification settings - Fork 45
Improve the completion bounds detection (now with keywords) #129
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
Improve the completion bounds detection (now with keywords) #129
Conversation
@
(deref) to the expression breaking chars.
This needs more work as other things are failing, like completing |
bc14f8a
to
a037ea1
Compare
The two changes are running fine locally, the problem is the tests are failing for some reason. |
a037ea1
to
8d8ec41
Compare
I think I need some help with the tests because they are not very nice. For instance you cannot understand what is wrong when something fails. |
edcca0b
to
86fae72
Compare
Btw, you might want to also consider |
I have checked buttercup thoroughly and stamped upon jorgenschaefer/emacs-buttercup#37. It seems things are in motion, slowly, but It should end up in core and probably at some point will have BDD testing in it: https://github.com/phillord/assess/blob/master/README.md#roadmap I so like the helper functions for buffer testing, which is basically what I am doing here, so if you don't mind I will try that first. |
86fae72
to
14fced8
Compare
test/inf-clojure-tests.el
Outdated
(expect (ict-bounds-string (inf-clojure-completion-bounds-of-expr-at-point)) | ||
:to-equal "deref")))) | ||
|
||
(it "computes bounds for ^:keyword when point is after it" |
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.
This is failing still, but I moved to buttercup
and assess
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.
What is it actually matching?
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.
it should compute :keyword
without the hat
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.
Now it is returning nil
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.
And what happens when you try this interactively?
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 tried not in a test, in normal buffer it was working
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.
So if you open an inf-clojure-minor-mode
buffer and put this in it:
^:pr|
In ielm
you'll see:
ELISP> (inf-clojure-completion-bounds-of-expr-at-point)
(2 . 5)
test/inf-clojure-tests.el
Outdated
(ict-with-assess-buffers | ||
((a (progn | ||
(insert "@deref") | ||
(goto-char 7)))) |
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.
Isn't your cursor right after the word when you do insert
anyways?
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.
Well, now I know 😉
14fced8
to
2feb03a
Compare
I ended up improving the regex (big dragons in elisp regexes!) and adding keyword detection so that now tests are passing with flying green colors. |
There's a conflict with your other PRs, but overall the changes look good. |
They were both missing and therefore the inf-clojure was not able to identify completions bounds correctly.
For instance we want to avoid using substring-no-properties while typing ^| (where | is point) because it will error out.
The patch copies functionality from cider so that now inf-clojure can detect and extract keywords (colons included) when a symbol at point is not found.
This patch add ert test harness and some tests around the inf-clojure-completion-bounds-of-expr-at-point function.
f27cc86
to
12ce769
Compare
@bbatsov Done, can't wait to have tests in 😄 |
Your wait is over. ;-) |
Thank you @bbatsov! |
It was missing, but it is actually used for identifying completions bounds.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
M-x checkdoc
warnings