Clojure Eclipse plugin progress (clojure-dev)

95 views
Skip to first unread message

Casey Marshall

unread,
Oct 13, 2008, 10:49:51 PM10/13/08
to Clojure
Hi,
I humbly present my first steps toward an Clojure Eclipse plugin
(http://code.google.com/p/clojure-dev/). So far, here's where its at:

* Clojure nature, project type and builder (which doesn't do much
yet).
* Added a Clojure REPL to the console. You can open it with the "New
Console" button on the console view.
* When editing a *.clj file, you can run the current file, which will
get loaded into the REPL console.

The REPL console has direct access to the Eclipse runtime and should
be able to manipulate the workbench. That's right.. its an Eclipse
minibuffer!

Some background on clojure-dev... for some reason, I had to add a
Class.forName("clojure.lang.RT") in my Clojure OSGi bundle's start().
Otherwise I was not able to run Clojure within Equinox -- I believe it
was a Compiler.loadFile issue on the core Clojure files. I originally
tried basing my plugin on the DLTK without much luck -- the DLTK does
not seem very relevant to targeting the JVM, its more like something
you'd use for an out-of-process scripting language environment. I'm
going to go my own way and hook into the JDT where I have to. I'm
looking at CUSP, PyDev, and Scala SDT for inspiration.

My next steps are to focus on Clojure language support and better JDT
integration (classpath, etc.). Deployment and tooling is a big deal
to me, I think they're essential to being productive with the Java
platform -- even if the Clojure language is more productive, the Java
batteries included still require a lot of typing!

I know the Eclipse platform pretty well but from an Equinox & RCP
background. I'm new to IDE development, so this is quite a learning
experience!

Cheers,
Casey

mac

unread,
Oct 14, 2008, 9:27:07 AM10/14/08
to Clojure
I use eclipse daily at work so I'm pretty used to it, would be very
nice with a clojure plugin.
Are you taking feature requests?
If you are, here is mine:

I like a good IDE as much as anyone but so far I have been using emacs
with Jeffrey Chu's clojure-mode (http://clojure.codestuffs.com/).
Coming from a VS/eclipse background I feel comfortable with a full IDE
but I have discovered something about most IDE's when I have been
using emacs.
While they do a good job of integrating stuff, their editors actually
suck, at least in their default configurations.

So I humbly submit a request to you to try to make the editor have the
same features as the clojure paredit mode, at least as an option one
can enable. What I really like about it is that it is sexp-aware, it
will help you balance parens and brackets by inserting pairs
automatically and prevent you from deleting non empty expressions.
There are also keyboard commands for "expanding" or "shrinking" an
expression to include/exclude symbols or expressions around it/inside
it while automatically preserving correct indentation. Plus of course
the standard stuff like keyboard commands for eval last expr, eval
buffer, eval region (selection) etc. that really helps with
interactive development.

As much as I like the whole IDE idea, I am starting to get so used to
the fantastic editor that emacs is when properly configured that I get
a little annoyed writing java in eclipse at work because it doesn't
really offer much more than syntax highlightning and inserting some
brackets (yes code completion is great and all but not really an
editor feature in the sense I mean here).

To sum up a very wordy post: if you could make the editor as good as
the emacs mode, that would be awesome!

/Markus

Stefan Liebig

unread,
Oct 14, 2008, 9:12:27 AM10/14/08
to Clojure
Great, this sounds really nice. I will have a look at it.

I created a clojure library bundle from the clojure.jar and a
second bundle that depends on the first. The seconds bundle
activator calls two clojure functions for start and stop of the
bundle passing the BundleContext to the clojure functions.
These two functions currently just print that they had been
started and stopped. Well, that is not that much, I know.
However, there was no need to work with reflection.

Tschüß,
Stefan

On Oct 14, 4:49 am, Casey Marshall <casey.marsh...@gmail.com> wrote:

Casey Marshall

unread,
Oct 14, 2008, 10:18:20 AM10/14/08
to Clojure
Thanks Markus,
I agree, awareness of sexps will be very important. Sounds like I
have some research to do with clojure-mode.

Casey

JumpingJupiter

unread,
Oct 14, 2008, 11:00:52 AM10/14/08
to Clojure
> I humbly present my first steps toward an Clojure Eclipse plugin
> (http://code.google.com/p/clojure-dev/).

It seems your writing your plug-in in java. I don't know anything
about Eclipse plug-ins; it should be possible (maybe not desirable) to
write the plug-in in clojure right? what are your reasons for using
java?

Casey Marshall

unread,
Oct 14, 2008, 2:35:35 PM10/14/08
to Clojure
Writing Eclipse plugins in Clojure is very interesting is a long term
goal. In order to pull that off, I would need to extend/implement
Eclipse platform classes and interfaces in Clojure, and export these
classes in an Eclipse plugin, which is an OSGi bundle.

Scala rewrote their Eclipse plugin in Scala at a certain point -- but
Scala is easier as it compiles to *.class files. Clojure will be more
challenging as I'll need to hook up clojure.lang.Compiler to the
classloader directly, and expose dynamically compiled bytecode.
However, the potential could be huge. Not only could Clojure be used
for Eclipse PDE development, but Clojure-OSGi bundles would
interoperate with other OSGi solutions (Glassfish, Apache ServiceMix,
etc.). OSGi would give Clojure apps some nice deployment options and
a new devious way to sneak Clojure into the enterprise :)

In the meantime, I'm ok with developing in Java now with the
possibility of rewriting in Clojure later. This ugly Java code will
at least serve as a blueprint for what's to come.

Casey

On Oct 14, 10:00 am, JumpingJupiter <jonathon.schofi...@gmail.com>
wrote:

Casey Marshall

unread,
Oct 14, 2008, 5:34:09 PM10/14/08
to Clojure
Well, there's also gen-class... I'm still getting to know clojure...

lpetit

unread,
Nov 26, 2008, 4:54:50 PM11/26/08
to Clojure
Hello,

In order to help a poor javaish like me go straight to the point with
what emacs offers concerning what you say below (sexpr ...), what
would you consider the best link to follow and read to understand the
functionalities, and have the keyboard shortcuts.

Indeed, I intend to (humbly) do something like that in a java editor
in clojuredev, but I'm currently not emacs versatile.

Thanks in advance,

--
Laurent

On 14 oct, 14:27, mac <markus.gustavs...@gmail.com> wrote:
> I use eclipse daily at work so I'm pretty used to it, would be very
> nice with a clojure plugin.
> Are you taking feature requests?
> If you are, here is mine:
>
> I like a good IDE as much as anyone but so far I have been using emacs
> with Jeffrey Chu's clojure-mode (http://clojure.codestuffs.com/).
> Coming from a VS/eclipse background I feel comfortable with a full IDE
> but I have discovered something about most IDE's when I have been
> using emacs.
> While they do a good job of integrating stuff, their editors actually
> suck, at least in their default configurations.
>
> So I humbly submit a request to you to try to make theeditorhave the
> same features as the clojure paredit mode, at least as an option one
> can enable. What I really like about it is that it is sexp-aware, it
> will help you balance parens and brackets by inserting pairs
> automatically and prevent you from deleting non empty expressions.
> There are also keyboard commands for "expanding" or "shrinking" an
> expression to include/exclude symbols or expressions around it/inside
> it while automatically preserving correct indentation. Plus of course
> the standard stuff like keyboard commands for eval last expr, eval
> buffer, eval region (selection) etc. that really helps with
> interactive development.
>
> As much as I like the whole IDE idea, I am starting to get so used to
> the fantasticeditorthat emacs is when properly configured that I get
> a little annoyed writing java in eclipse at work because it doesn't
> really offer much more than syntax highlightning and inserting some
> brackets (yes code completion is great and all but not really aneditorfeature in the sense I mean here).
>
> To sum up a very wordy post: if you could make theeditoras good as
Reply all
Reply to author
Forward
0 new messages