+48

Clojure auto-indentation is almost never correct

Anthony Grimes 13 jaar geleden bijgewerkt 12 jaar geleden 2
There are a number of cases where auto-indent isn't correct in Clojure. Here are some examples:

https://refheap.com/paste/797

Function arguments are supposed to be lined up. The vector should be lined up with the + sign, like this:


Another example is this:


when it should be:


This is just totally broken.  Notice how in the st2 formatted example, it's like the keywords are indented against the -> instead of the mongo/fetch function. It's pretty crazy. I'm sure there are more quirks but this is just what I ran into playing for a few minutes.

P.S. I apologize for pasting code elsewhere. I couldn't figure out how to format it nicely in uservoice.
+1

There is now a great plugin for this: sublime-lispindent. You can install it directly from Package Control.

That plugin isn't a replacement for fixing this in the textmate bundle or a new bundle. The plugin doesn't integrate with anything in Sublime Text, such as the native reindent command and `=ab` reformatting in vintage mode. It's a temporary work around for people who need it right now, but it isn't a real solution.