Saturday, April 16, 2016

Quickfix all the things with Sarsi

Here is a new project which got released recently on github and hackage, it is named Sarsi and it aim at being a sort of pandoc for quick fixing.

Quick fixing

It's basically fixing inside your text editor/IDE the warnings or errors returned by the compiler/build tool.


A sample session using sarsi-hs and sarsi-nvim.


Motivation

I do use nvim with stack, and even though I really appreciate all the features provided by the neomake integration. I really like also to have my build tool running continuously and fix from the output of it, especially when hacking on source dependencies.

Doing some coding with sbt as well, it always felt wrong I had to use two completely different setups to solve the same problem.

Design

Sarsi decouple this problem using a simple protocol which is implemented using msgpack and unix pipes. This should make it easily to embed a client directly into a text editor or a build tool.

The current implementation is written in Haskell, the library provide the main abstractions to write consumers/producers.

Where the terminology might ring a bell to those familiar with message brokers, we can basically say that a consumer is a text editor and a producer a build tool. This can slightly vary depending of integration needs.

Modules

There is currently two producers, one for Haskell, sarsi-hs (which should work with cabal and stack, but only tested with the later) and an other one for SBT, sarsi-sbt.

They do work slightly differently as you'll see in the documentation, but those details are abstracted away by the protocol.

It is then possible to consume those fixes using one of the two consumers.

The first, sarsi-nvim works exclusively for Neovim and gives the best experience and the easiest integration path.

If you prefer to keep your good old vim/vi, there is an other consumer,
sarsi-vi which will have to be started independently of your text editor.
It will then maintain in real time a file containing the fixes which you can load/reload using :cfile `sarsi`.vi .

Get started

If you would like to give Sarsi a try, checkout the README at:
github.com/aloiscochard/sarsi

You'll find there installation instruction, but if you have issues or would like to contribute a consumer/producer just join gitter.im/aloiscochard/sarsi for a discussion.









No comments:

Post a Comment