Hi everyone,
1.4.0 is out now! The main new feature in this release is the creation of stub files to help symbol resolution for libraries which for one reason or another are difficult to index. Cursive works by indexing source code, and some libraries cannot easily be indexed this way for one reason or another. Datomic is the most prominent example here, for the simple reason that it’s closed source. However other libraries also do things that are difficult - Carmine and Amazonica dynamically create vars for calling APIs from an abstract description of those APIs, Conman creates vars allowing SQL queries to be executed from the queries themselves, Om creates DOM manipulation functions from a list of DOM elements and so on. And finally, libraries like Midje and Overtone simply do so much macro magic and runtime var creation that it’s unrealistic to expect to ever be able to understand their source fully.
Now, when your project uses one of these libraries, you’ll be prompted to create stubs for indexing. For Clojure code, this will load the relevant namespaces in an external process and then introspect the vars to create a source file representing the vars available for that namespace. ClojureScript code does something similar by invoking the CLJS analyser. These files are in a hidden location but will be automatically added to the indexing set for your project, and can be used for find usages, completion, doc lookup etc. Since namespaces can contain a mix of dynamically generated vars and standard vars in source, only the ones that Cursive cannot index correctly from the source will have stubs created.
Currently stubs will be created for Datomic, Midje, Om, Om Tools, Carmine, Overtone and Amazonica. In a future version, you will be able to configure the namespaces that should receive this treatment. In the case of Overtone, the stubs are required but they’re not sufficient to use Overtone comfortably - I’ll have to add further support. Currently this is designed for namespaces from libraries, so it does not work correctly with tools like Conman yet since it creates vars in your project namespaces. Also, since this change is designed for library code, Cursive will not pick up the change if you add a new require for one of these namespaces. It currently only checks when adding or removing libraries to/from the project, so the easiest way to refresh is to use the Refresh Leiningen Projects action, or the equivalent for the build tool you’re using. This will be fixed in the final release.
This release adds support for new changes in Clojure around namespaced keywords (see CLJ-1910 and CLJ-1919), which are intended to make spec easier to work with. It also fixes a related bug with :or forms in map destructuring. It also correctly renames namespaced keywords when renaming aliases.
Support has been added for IntelliJ 2016.3, and for Leiningen 2.7.0 and the new managed dependencies feature. The new clojure.* -> cljs.* namespace aliasing in ClojureScript code is now also supported.
Cursive is now smarter at defaulting the namespace type when creating new namespaces, which was something that was very annoying for users who frequently work in mixed Clojure/CLJS files. There’s also now an action to convert files between .clj, .cljs and .cljc.
Also in this release, I finally fixed the nREPL stdin issue and fixed a couple of other REPL quality of life issues, as well as numerous bugs.
Here are the issues:
Cheers,
Colin