Sublime Forum

Universal external development tool to unite dev. editors families

#1

Preamble

For many years (10+) I am using home-maid build tool that simplifies my daily working experience. Since it has been written as home-maid product, it doesn’t100% fit to be advertised to wide audience of developers. But probably now it makes sense at least to share the experience.

The one of a powerful feature of the tool is possibility to be integrated with different dev. editors. I have used this build tool with Med editor (Does anybody knew it :)), TextMate, Sublime2/3 and even VSCode. I think the usage of an external tool has number of advantages that helps to make development process more smooth and less laggy. For instance to me it is still quite annoying to work with VSCode because all these background helpers and suggesters, what more disturbs than helps.

Lithium (external development tool)

First of all, I have to say lithium is written in Ruby. For someone it can be a show stopper. To me Ruby is one of the best dynamic OOP language. 10 years ago I have met the language the first time, it has impressed and inspired me significantly (code block, mixing, proper, clear OOP meta model, cool collections set, etc looked impressive).

I am using lithium tool mostly for Java, JavaScript, Ruby and Python development. The most required and well done feature is simplification of compilation/running the code you are writing. The output of compilers / runner is captured, re-formatted and parsed by lithium with a number of customized matchers.

Usage (Imagine lithium and sublime package is installed on your PC)

Create “.lithium” folder in your workspace. Open the workspace (folder) in Sublime. if you have Ruby, Java, Python, Kotlin, Scala, Groovy, JavaScript, etc code in your workspace you can easily compile, run, check style, uglify, etc. Lithium selects appropriate compiler / runner depending on an active edited file and tries to automatically detect environment, class paths, libs that are required basing on the workspace structure. The example of a result of lithium Sublime compilation is shown below:

Using the output you can navigate to problem lines of your code by clicking the problems in the output window or selecting it from problems window.

Configuration

Lithium introduces simple DSL language that helps to identify available for your project artifacts and its dependencies. Artifacts of the current project can be declared inside “.lithium/project.rb” file. Artifact is defined by optional classifier prefix and a target path. Classifier defines the type of artifact, a target path points to a target(s) that have to be processed. Find below a fragment of default lithium project DSL:

ARTIFACT("compile:*") {
    ARTIFACT('**/*.java',   JavaCompiler)  { OPT "-Xlint:deprecation" }
    ARTIFACT('**/*.groovy', GroovyCompiler)
    ARTIFACT('**/*.kt',     CompileKotlin)
    ARTIFACT('**/*.scala',  CompileScala)
    ARTIFACT('**/*.rb',     ValidateRubyScript)
    ARTIFACT('**/*.php',    ValidatePhpScript)
    ARTIFACT('**/*.py',    ValidatePythonScript)
    ARTIFACT('**/*.xml',   ValidateXML)
    ARTIFACT('**/pom.xml', CompileMaven)
    ARTIFACT('**/*.tt',    CompileTTGrammar)
    ARTIFACT('**/*.sass',  CompileSass)
}

Now I would like stop disturbing Sublime community with the tool. But if you find the subject useful I can provide more detailed overview. The project code can be found by link below (please, be aware, home-maid project is in :)):

https://github.com/barmalei/lithium

0 Likes