Examples

Alexander Yakushev edited this page Jan 7, 2016 · 9 revisions

This page shows examples of how Compliment handles different completions.

Vars

Compliment can complete vars in the current namespace. It looks like this:

As you can see, help popup is displayed as well for the completion highlighted in a popup menu.

Scoped completions are covered too:

There is more than that to var completion. Take a look:

For vars containing dashes, you can type only first few symbols for each part between the dashes, and Compliment will figure out what you want!

You can actually skip writing dashes too:

Next, with the help of contexts, Compliment can intelligently complete :only vars you want to :use in your ns declaration (same goes for :require’s :refer).

In this case the completion shows only vars from clojure.set namespace.

Namespaces

Compliment can do simple namespace completion:

Furthermore, same as for vars, you can specify only first few letters between the periods:

Or without periods:

Tired of typing clojure.java.io? Just type cji and press TAB, Compliment will handle it for you!

Keep in mind that extra fuzziness (i.e. without periods) works only for namespaces that are loaded into the current session to avoid cluttering completion suggestions.

Classes

Just like namespaces, Compliment allows you to complete classnames (both short and package-qualified). Fuzzy-completion for classes:

For performance reasons fuzziness works only for classes that are imported into the current namespace. For all others only the basic by-prefix completion is available:

Static members

Here’s an example of static class-member completion:

Non-static members

Example of non-static member completion:

Fuzzy-completion for members splits a prefix on camel-case capital letters (like Eclipse does). See this sheer awesomeness:

If even this is not enough for you, check out what happens if you write an object first, and then try to complete a method for it:

Did you see that? Only methods that belong to String are offered! Unfortunately, this is limited to vars that contain objects, since Compliment won’t evaluate the expression at object’s position in order to not mess anything up.

Keywords

Compliment allows to complete any keyword that was used during the current session (or introduced by any of the libraries):

Local bindings

Compliment can complete local bindings introduced by let, defn and the like:

Extensions

I’m working on custom completions for Neko library. Right now it can complete keyword resources:

Notice a custom help text that shows the value of the resource string.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.