Awesome
Parinfer on the JVM
A Parinfer implementation written for the JVM in Kotlin.
About
There are several popular text editors that run on the JVM. Having a fast Parinfer implementation available on the JVM allows Parinfer to reach more editors.
This implementation is a 1-to-1 port of parinfer.js. It strives to be feature equivalent with parinfer as described in the Indent Mode and Paren Mode sections of the main website.
If you find behavior that does not match parinfer.js, please report it as an issue in this project.
The .json
files in the tests folder are copied directly from the main
Parinfer repo.
Installation
or build/install from source (see Development Setup below).
Usage
(ns ...
(:import [com.oakmac.parinfer Parinfer]))
(Parinfer/parenMode text x line nil false)
(Parinfer/indentMode text x line nil preview-cursor-scope?)
Alternatively see cross-parinfer which wraps this project and provides a Clojure/ClojureScript interface.
Development Setup
# run a gradle build and install the artifact in your local repo
# NOTE: this step may take a while
./gradlew install
The resulting jar file will be under build/lib
# run the tests
./gradlew clean clojureTest
To run the performance benchmarks, comment out the following block in
build.gradle
:
sourceSets.test.clojure {
excludeNamespace 'parinfer-test.performance'
}
Then run the tests as above. There is probably a better way to do this, but it's way beyond my Gradle-fu. PR welcome!