Code Monkey home page Code Monkey logo

clojure-complete's People

Contributors

brandonbloom avatar laurentpetit avatar ninjudd avatar tirkarthi avatar trptcolin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clojure-complete's Issues

completions results sorted by "kind" ?

Consider the following command:

=> (pprint (completions "clojure.core"))
nil
("clojure.core"
 "clojure.core.ArrayChunk"
 "clojure.core.ArrayManager"
 "clojure.core.IVecImpl"
 "clojure.core.Vec"
 "clojure.core.VecNode"
 "clojure.core.VecSeq"
 "clojure.core.protocols"
 "clojure.core.protocols.InternalReduce")

first is a namespace, then some classes, then a namespace, then some classes

What do you think about having things sorted first by "kind", then by alphabetical name ?

kinds could be sorted as is: first namespaces then vars then classes then instance members then static members

e.g. having this behaviour instead:

=> (pprint (completions "clojure.core"))
nil
("clojure.core"
 "clojure.core.protocols"
 "clojure.core.ArrayChunk"
 "clojure.core.ArrayManager"
 "clojure.core.IVecImpl"
 "clojure.core.Vec"
 "clojure.core.VecNode"
 "clojure.core.VecSeq"
 "clojure.core.protocols.InternalReduce")

textmate-completion style

A feature I'd like to have in Counterclockwise is "Textmate-completion" style.

e.g. asking completion for "sbc" would match "set-bundle-classloader!" var.

Move to flatland?

@trptcolin what do you think of moving this repo to the flatland organization since I'm not really the primary contributor anymore?

Status, question on potential enhancements, etc.

Hello,

I don't know where else to start discussing this, so why not the bug tracker?

In a nutshell: I'm considering dropping the current "legacy" code used by Counterclockwise (the Eclipse plugin for Clojure) in favor of a shared external library like clojure-complete.

So in order to evaluate the feasibility, here are some questions:

  • a feature I'd like to have in Counterclockwise is "Textmate-completion" style, e.g. asking completion for "sbc" would match "set-bundle-classloader!" var. This feature does not exist yet in Counterclockwise, so I'm considering either adding it to Counterclockwise's legacy code, or contributing it to clojure-complete, if it's an enhancement that you'd like to have.
  • a feature Counterclockwise had is completion for java interop calls. e.g. ".toSr" would get suggestions for ".toString", etc. There are several things to discuss about the detail, but I'm willing to contribute.
  • question about function ns-java-methods: I see ":when (static? ..." where I would have expected ":when (not (static? ..."

intermediate more "essential" result sequence - rendering agnostic

To serve the purpose of several kinds of "displays" (console, editors, etc.), it would be interesting to not drop "too early" information on the results. E.G. once a var, a Class, a MethodHandler have been "rendered"/"reified" to a String, it's too late for easily sorting/displaying/further filtering the result in different ways.

Maybe we could have first the non-reified results returned, and construct above this (respecting the current "API" to not break existing client code) a default textual rendering layer.

For example, for Counterclockwise's purpose, I may enrich the "bare list" with more information such as repeating the namespace the var was aliased/used from, the type of the completion (:var, :namespace, :class, :static-member, :instance-member, etc.), the arglist, the documentation, etc.

Completing namespaces should also show the public vars of that namespace

There should be a function that performs a "deep complete" inside namespaces. For example, f I complete clojure.co, it should show me clojure.core, as well as everything under that namespace: clojure.core/seq, clojure.core/vals, ...

The big advantage of having such a function is that it allows Emacs to do partial completions in all cases. Right now, if I complete l-s using the partial completion style, lazy-seq will be an option. This is because Emacs will first complete l, and do the rest of the matching itself, as lazy-seq will be one of the matches. But if I try to complete clojure.core/l-s, partial completion will fail, as it will first try to complete clojure.core. Since this will return no additional completions, Emacs will erroneously say it can't complete clojure.core/l-s.

One work around for the preceding example is to add a new completion style that checks for a namespace and triggers completion for clojure.core/l. I'm doing this as a workaround for now, but the big disadvantage of such an approach is that I can't complete partially specified namespaces such as c.c/l-s.

It's simple enough to do a deep complete, but I won't submit a patch as I don't know what angle you all would like to take. I could see this being computationally intensive, so maybe there is a smarter solution that clojure-complete and Emacs (and maybe repl-y?) could meet halfway on.

(Also crossref'ing #5 as similar, although I find it a bit funny that the completion style in question is being called "textmate-style" :-))

Add more tests to get a better non-regression-like test suite

Everything's in the title.

Before adding new features, I'd be happy adding more tests to the test suite :

  • more tests showing more of the code completion behaviour
  • more tests for code / feature coverage

We could get inspiration from Enclojure's great documentation website for the coverage of the tests.

Tab completion after typing a period in a namespace triggers an NPE

Bit of an oddly specific bug, I know.

TL;DR - if I type clojure.co and then try to tab-complete, an NPE is triggered. Tab-completion works fine if I hit tab at cloj or at clojure.core/, but after that first period and before the slash I'll get NPE'd. I ran into this on a project and then was able to reproduce outside of a project context.

Now the expected behavior would be for tab completion to work the way it did when I hit tab at cloj, i.e. to show me the list of namespaces that are potential results for what I've typed so far.

Full command history and stacktrace:

▸ lein repl
nREPL server started on port 55883 on host 127.0.0.1 - nrepl://127.0.0.1:55883
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 9.0.1+11
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> clojure.corNullPointerException   complete.core/fn--632/iter--624--633/fn--634 (core.clj:66)


CompilerException java.lang.ClassNotFoundException: clojure.cor, compiling:(null:0:0)
user=> (pst)
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.cor, compiling:(null:0:0)
                                Compiler.java:6688 clojure.lang.Compiler.analyze
                                Compiler.java:6625 clojure.lang.Compiler.analyze
                                Compiler.java:6931 clojure.lang.Compiler.eval
                                Compiler.java:6890 clojure.lang.Compiler.eval
                                     core.clj:3105 clojure.core/eval
                                     core.clj:3101 clojure.core/eval
                                      main.clj:240 clojure.main/repl[fn]
                                      main.clj:240 clojure.main/repl[fn]
                                      main.clj:258 clojure.main/repl[fn]
                                      main.clj:258 clojure.main/repl
                                      main.clj:174 clojure.main/repl
                                  RestFn.java:1523 clojure.lang.RestFn.invoke
                         interruptible_eval.clj:87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate[fn]
                                      AFn.java:152 clojure.lang.AFn.applyToHelper
                                      AFn.java:144 clojure.lang.AFn.applyTo
                                      core.clj:646 clojure.core/apply
                                     core.clj:1881 clojure.core/with-bindings*
                                     core.clj:1881 clojure.core/with-bindings*
                                   RestFn.java:425 clojure.lang.RestFn.invoke
                         interruptible_eval.clj:85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
                         interruptible_eval.clj:55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
                        interruptible_eval.clj:224 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval[fn]
                        interruptible_eval.clj:192 clojure.tools.nrepl.middleware.interruptible-eval/run-next[fn]
                                       AFn.java:22 clojure.lang.AFn.run
                      ThreadPoolExecutor.java:1167 java.util.concurrent.ThreadPoolExecutor.runWorker
                       ThreadPoolExecutor.java:641 java.util.concurrent.ThreadPoolExecutor$Worker.run
                                   Thread.java:844 java.lang.Thread.run
Caused by: java.lang.ClassNotFoundException: clojure.cor
                           URLClassLoader.java:466 java.net.URLClassLoader.findClass
                        DynamicClassLoader.java:69 clojure.lang.DynamicClassLoader.findClass
                              ClassLoader.java:563 java.lang.ClassLoader.loadClass
                        DynamicClassLoader.java:77 clojure.lang.DynamicClassLoader.loadClass
                              ClassLoader.java:496 java.lang.ClassLoader.loadClass
                                  (Unknown Source) java.lang.Class.forName0
                                    Class.java:375 java.lang.Class.forName
                                      RT.java:2168 clojure.lang.RT.classForName
                                      RT.java:2177 clojure.lang.RT.classForName
                                Compiler.java:7145 clojure.lang.Compiler.resolveIn
                                Compiler.java:7108 clojure.lang.Compiler.resolve
                                Compiler.java:7069 clojure.lang.Compiler.analyzeSymbol
                                Compiler.java:6648 clojure.lang.Compiler.analyze
nil

Originally reported as a Leiningen issue here: technomancy/leiningen#2380

completion "contraction"

It is possible that a user has 'used (or 'aliased) in the current namespace another namespace, but is triggering completion with the fully qualified namespace (maybe he doesn't remember the namespace has been 'used or 'aliased, maybe he wants to "filter" the search to this particular namespace).

In that case, instead of suggesting the var's symbol as provided by the user, we could/should (?) suggest the bare symbol (resp. aliased symbol) :

example:

(ns 'user)
(require 'clojure.set)
(completions "clojure.set/un")
; => ( "clojure.set/union")
(require '[clojure.set :as set])
(completions "clojure.set/un")
; => ("set/union")
(use '[clojure.set :only [union]])
(completions "clojure.set/un")
; => ("union")
(completions "set/un")
; => ("union")

Partial class name completion patch

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

completion for java-interop calls

a feature Counterclockwise had is completion for java interop calls.

e.g. ".toSr" would get suggestions for ".toString", etc.

There are several things to discuss about the detail.

Side note: question about function ns-java-methods: I see ":when (static? ..." where I would have expected ":when (not (static? ..."

Deprecated in favour of compliment?

compliment provides more features than clojure-complete and is actively maintained. As this project seems dormant I guess it makes sense to formally deprecated it in favour of compliment.

Let the user disable Clojure-generated classes

Hello there,

Completions such as clojure.core$unchecked_remainder_int or the more extreme ring.adapter.jetty/ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0 can be pretty noisy both in terms of number and length, especially when leveraging popup-based completions such as ac-nrepl.

Can these be disabled? If that was the case, a nice config mechanism surely would be providing a key at one's project.clj.

Thanks - Victor

Please tag releases to clojars

This library is a dependency for leiningen itself and it would
be really great if the published version in clojars (0.2.3)
had a matching tag here. Would you please tag the repo with 0.2.3?

Thanks!

java.ext.dirs is deprecated

So in ubuntu xenial, using openjdk 9, it seems like java.ext.dirs isn't present. This may be due to a change in the structure of how java is distributed/runs according to http://openjdk.java.net/jeps/220. In any case, the behaviour I'm getting when trying to use repl completion is this:

https://gist.github.com/pcn/6272f116e6884728a66a

It was suggested in IRC that this is the root of the problem:

path (.split (System/getProperty prop) File/pathSeparator)

I'm not sure what an appropriate fix would be, but I'm reporting this in the hope that it helps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.