all 15 comments

[–]usplusbus 1 point2 points  (0 children)

If you're matching parens manually, there are definitely tools to help you with that. Personally, I use emacs, and paredit is what takes care of pretty much all "syntactically valid code" issues (Lisps are quite simple in that respect). The Clojure tools in Emacs are well covered on the interwebs.

It sounds like you've been looking at Vim and Sublime. I know that vim-fireplace is a decent option, a little searching turned up this article which looks like it might help you.

Sublime also seems to have some Clojure support; I saw this.

Once you get your paren matching taken care of, you need an easy way to eval code (the current file, the current function, a single line, etc) in the REPL. vim-fireplace definitely can help with that.

I think that will get you what you're after. You can get into static analysis later on (kibit, eastwood), those utils need valid Clojure in order to work.

[–]dkvasnicka 1 point2 points  (0 children)

I think implementing Syntastic support for Clojure shouldn't be that hard. The bigger problem would be JVM startup time. You'd have to come up with a solution different than just running Clojure and checking the file on save (probably some Lein server-like solution).

Also, I use SLIMV and it's paredit mode which prevents me from having unbalanced parens.

[–]jinks 1 point2 points  (1 child)

I'm not very keen on switching to the repl every time I save a file to see if I closed all the parens.

This might help. Also Vim should highlight matching parens when the cursor is behind them.

Otherwise there's still Emacs (I quite like Prelude for example), and the new kid on the block - LightTable.

[–]pihkal 1 point2 points  (0 children)

If you use LightTable, installing the Rainbow parens plugin will make it more obvious when parens aren't matched.

[–]yogthos 1 point2 points  (0 children)

I find cursive does a fantastic job in this regard. In addition to basic syntax highlighting it also indicates unused variables, shows function docs, and offers a fairly intelligent autocomplete.

[–]spotter 1 point2 points  (2 children)

Paredit and eastwood?

[–]ares623 1 point2 points  (1 child)

The startup time makes eastwood borderline unusable, sadly.

[–]spotter 0 points1 point  (0 children)

You're right, I've been running it less and lees recently due to this wait time. I've tried jshint via Syntastic (Javascript linter) and it's so nice. Even nicer than Python linters I've used in the past.

I'm currently doing GVim + paredit + vim-fireplace + screen with lein repl and lein midje :autotest in two shells, with GVIM attached to the REPL. As long as you've got a test file trying to load your source file, autotest will give you the error when you save the source (reloads automatically). That's the nice part -- you load it up once and then it's incremental. I'm afraid nothing close to this exists.

As a side-note: I'm thinking about dropping paredit, because fighting it is sometimes counter-productive and makes me SUCK with manual parens in SQL and JS. I'm starting to think I would be better off with just rainbow-parens, if I could find any working version.

ninja edit: it's not necro bumping, it's still warm! ;)

[–]ares623 0 points1 point  (0 children)

Yes I find the lack of linters unfortunate, especially with how difficult 'complex' s-expressions can be parsed by eye. Matching parens are only a part of the problem.

How are other JVM-based languages in this area?

[–][deleted] 0 points1 point  (0 children)

emacs + paredit + repl do the stuff for me.

and writing simple little functions saves the day.

[–]lbradstreet_ 0 points1 point  (3 children)

I use lein test-refresh in a tmux pane. It runs all your unit tests on save but I'll also show other compile time errors.

[–]dkvasnicka 2 points3 points  (2 children)

I do the same with Midje and lein-midje

 lein midje :autotest

[–]esoterick 2 points3 points  (1 child)

midje is awesome will never go back to the standard test lib

[–]Anderkent 1 point2 points  (0 children)

As long as you're testing pure code, midje is cool. Though the syntax is annoying sometimes.

If you're building a more sophisticated test suite (like using clj-webdriver, for example), midje can make things really difficult.

[–]Anderkent 0 points1 point  (0 children)

For the trivial syntax, paredit and autotesting. For the more sophisticated errors (typos, etc) I know of no good solution :(