Skip to content
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

Partial class name completion patch #12

Open
nkkarthik opened this issue Jul 15, 2012 · 0 comments
Open

Partial class name completion patch #12

nkkarthik opened this issue Jul 15, 2012 · 0 comments

Comments

@nkkarthik
Copy link

I have modified the code to auto-complete a partial classname,
without needing the package name (makes it very easy to
find/enter class when you forget the package name or even the
exact class name). I found it useful in my personal work, so
thought could help others too.

It behaves as below:

user> (complete.core/completions "JFr")
("javax.swing.JFrame")

user> (complete.core/completions "Rob")
("java.awt.Robot" "java.awt.peer.RobotPeer")

Wildcard '*' is supported and can be used as below:

user> (complete.core/completions "Win*Ad")
("java.awt.event.WindowAdapter")

user> (complete.core/completions "Mou*Li")
("java.awt.event.MouseListener" "java.awt.event.MouseMotionListener"
"java.awt.event.MouseWheelListener" "javax.swing.event.MouseInputListener")

user> (complete.core/completions "Mou*In*L")
("javax.swing.event.MouseInputListener")

Uploaded patch here: https://gist.github.com/3117608

Changes:

  1. Use class names as potential-completions when there is a capital
    letter in the prefix
    (a curde assumption, I have to agree, that
    clojure vars may not have capitals).
  2. Instead of startsWith, use regular expression match to support
    wildcard too (see re-match).
  3. Some tests are updated.

Let me know what you guys think about it.

Thank you

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

No branches or pull requests

1 participant