Show HN: Nightcode, the Clojure IDE, just hit 0.1.0
nightcode.info
nightcode.info
So far I have resisted the temptation to use an IDE. Whenever I thought I needed a feature from an IDE, I investigated how to achieve it in Vim. I've become a reasonably advanced Vim user, and I feel very productive in it.
Am I a dinosaur on its way to extinction? Or can none of these new IDEs match the power of Vim?
I'm using LightTable right now, and thoroughly enjoying the Clojure experience. Can you explain what you see are the key differences in Nightcode vs. LightTable? I'm curious, because I would love to hear the thoughts of Nightcode's creator on this. I'm planning on giving Nightcode a try tonight.
> code completion:
Vim has Omnicomplete. But usually I find it easier to have a web browser side by side and look up function names, in the case I don't remember.
> inline docs
Same here: mostly by memory, and always a web browser open
> refactoring
I do these by hand, usually assisted by the venerable "grep".
My typing is pretty quick, and it is almost never the limiting factor. My limiting factor is usually thinking about how to decompose a problem, and writing tests. Not sure an IDE can help me there.
That said, I should probably give an IDE a try sooner or later.
For example, I'm currently editing a python file in IDEA.. I can easily, with one (chorded keystroke), see the definition of any symbol in my code, wether it be a local variable or a module. Similarly I can easily pull up docs, find any other usage of that symbol in the current file, etc. There is also high quality linting going on all the time, that will highlight things like unused variables, pep8 violations, etc.
Can you do all of this in VIM? Probably, but only with substantial effort.
As far as refactoring...IDEA goes way way beyond what you can do with grep.
For instance, say I have a function foo:
def foo(x):
return x * 2
foo(3)
This is a trivial example, but just go with it.What if I decide I need to multiply by things other than 2... fine,
def foo(x, y):
return x * y
foo(3) # Ooops, syntax error
Now, I can add y as an optional parameter, def foo(x, y=2)
... and that way I don't break code I've already written. But that may not be what I want - maybe I want to force callers to explicitly specify both parameters.That's what refactoring comes in.
Refactoring -> Change Signature (Or just hit Ctrl+F6)
Now, add a new parameter, y, with a value of 2, and now any existing calls to foo across my entire project will have a second parameter of 2. No grepping or manual editing needed. This works reliably over a huge codebase with hunderds of files. Lets see you do THAT with grep. That's just a trivial example.
I can also easily extract a bit of code as a new function, and IntelliJ's code analysis will detect any values I'm closing over and default to those as the function parameters, and replace the original call site with a call to the new function. Again, totally useful, painless, and not doable with grep.
(Also, syntastic+pyflakes for vim provides auto-linting and pep8 checking automatically for basically no effort).
Oddly enough, that's usually the objection I get when I tell people they should learn vim :)
FindThis(needle, haystack):
Then later you come to use this function, you cannot remember whether you made it Findthis(needle, haystack) or FindThis(haystack, needle). (OK so in python you could just name your arguments to avoid the issue but then you might have inconsistent coding styles)
IDEs' have completion of code and descriptions of arguments which makes calling any function trivial. You can go from barely remembering a function name to understanding all the parameters, optional or otherwise, within the time it takes you to type out the function you wanted. It means you don't have to context switch into "documentation" mode.
IDEs can give you:
- code navigation
- code validation as you type
- background compilation for languages with native compilers
- semantic refactoring
- integration with source control and issues trackers, allowing to map source code lines to issues and code history
- WYSIWYG design of user interfaces
- live static analysis while typing
- direct mapping between templates and code behind associated with them
- ...
Automatching parens (parenedit?), rainbow parens if you want, a built in repl, and after your repl is started for the namespace you are currently editing, auto suggest for any namespace in dependency graph. Viewing any included namespace code is simple as a double click - very helpful for learning clojure. Edit the file and after a key combo, your repl has your new function definition.
Counterclockwises workflow is pretty nice. I like it. I don't even have to go to command line to update deps, just edit project file and right click update dependencies. The only thing I use the command line for currently is lein ring server.
Eclipse has the concept of templates which you can define for other content types, but CC's editor isn't enabled to use them. I sort of missed them at first, but didn't after I realized anything I would put into a template should probably be a macro in clojure.
However when I have a project with imported namespace
(ns project.core (:require [seesaw.core :as s]))
then when I write s/ and hit ctrl+space, the autocompletion does not see the stuff defined in that namespace.
Do you plan to add this support to the editor, or it would be too big pain?
A small note, I was able to get a default android target to Run but Build crashed. It looks like the Build option isn't pulling in the android.jar file ...
This looks cool too, especially the android/java integration.
However I checked counterclockwise after a long period of time - and there is almost nothing I miss. Eclipse is not my cup of tea (I'm IDEA user, let the Holy IDE War begin :) ), but more pleasant experience than emacs.
Horses for courses, as it were.
but where is the documentation? I also checked the github page, nothing there too