Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 5 commits into from
Jan 30, 2018

Conversation

arichiardi
Copy link
Contributor

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):

  • The commits are consistent with our [contribution guidelines][1]
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)

@arichiardi arichiardi changed the title Add @ (deref) to the expression breaking chars. Add @ (deref) to the expression breaking chars. Jan 22, 2018
@arichiardi
Copy link
Contributor Author

This needs more work as other things are failing, like completing ^:private.

@arichiardi arichiardi force-pushed the add-deref-break-char branch from bc14f8a to a037ea1 Compare January 23, 2018 00:30
@arichiardi
Copy link
Contributor Author

The two changes are running fine locally, the problem is the tests are failing for some reason.

@arichiardi arichiardi force-pushed the add-deref-break-char branch from a037ea1 to 8d8ec41 Compare January 23, 2018 00:35
@arichiardi arichiardi changed the title Add @ (deref) to the expression breaking chars. Improve the completion bounds function Jan 23, 2018
@arichiardi
Copy link
Contributor Author

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.

@arichiardi arichiardi force-pushed the add-deref-break-char branch 2 times, most recently from edcca0b to 86fae72 Compare January 23, 2018 01:00
@bbatsov
Copy link
Member

bbatsov commented Jan 23, 2018

Btw, you might want to also consider buttercup (https://github.com/jorgenschaefer/emacs-buttercup) for the tests. I find it much nicer to use than ert. I use it on a few projects and I like it quite a lot. I think the only thing ert has going is that it's built-in.

@arichiardi
Copy link
Contributor Author

I have checked buttercup thoroughly and stamped upon jorgenschaefer/emacs-buttercup#37.

It seems things are in motion, slowly, but assess is probably the way for me to go.

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.

@arichiardi arichiardi force-pushed the add-deref-break-char branch from 86fae72 to 14fced8 Compare January 23, 2018 20:24
(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"
Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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)

(ict-with-assess-buffers
((a (progn
(insert "@deref")
(goto-char 7))))
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, now I know 😉

@arichiardi arichiardi force-pushed the add-deref-break-char branch from 14fced8 to 2feb03a Compare January 26, 2018 20:38
@arichiardi
Copy link
Contributor Author

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.

@arichiardi arichiardi changed the title Improve the completion bounds function Improve the completion bounds detection (now with keywords) Jan 26, 2018
@bbatsov
Copy link
Member

bbatsov commented Jan 28, 2018

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.
@arichiardi arichiardi force-pushed the add-deref-break-char branch from f27cc86 to 12ce769 Compare January 29, 2018 17:34
@arichiardi
Copy link
Contributor Author

arichiardi commented Jan 29, 2018

@bbatsov Done, can't wait to have tests in 😄

@bbatsov bbatsov merged commit 630471b into clojure-emacs:master Jan 30, 2018
@bbatsov
Copy link
Member

bbatsov commented Jan 30, 2018

Your wait is over. ;-)

@arichiardi arichiardi deleted the add-deref-break-char branch January 30, 2018 03:00
@arichiardi
Copy link
Contributor Author

Thank you @bbatsov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.