- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
jEdit ENSIME Thingy
https://github.com/djspiewak/ensime-sidekick
It occurred to me that perhaps this might be useful to someone else, even in its current state. It's basically the beginnings of a port of the Emacs ENSIME functionality over to jEdit. There is an existing plugin which attempts to do this in jEdit, but it embeds a modified version of ENSIME (and doesn't work post 2.8.1), so its usefulness is a bit diminished.
Right now, the following features work:
The big problem right now is the implementation is very machine specific (and specifically my machine). Again, this is largely because I need it for my own stuff and haven't gotten around to making it work for anyone else. The machine specific bits are documented in the README. Help here is also appreciated, especially if you're an SBT or a scala.sys.process guru. Or we can just leave it specific to my machine; works for me! :-)
Oh, another issue is that the plugin only maintains a single instance of ENSIME. That should be fixed soon, but until then, you will need to re-init ENSIME any time you switch to a file that's in a different project. Make sure you have a pre-existing .ensime file consisting of a single s-expression (no comments)!
No promises on maintenance here. As I said, I did this in anger since I really need this functionality for my own work. Any functions that I don't need (such as scaladoc lookup, debugging or file structure view) are unlikely to get implemented or maintained (in the event of someone else contributing an implementation). I'll maintain this exactly as long as I continue to use it myself. :-)
With all that said, enjoy!
Daniel
It occurred to me that perhaps this might be useful to someone else, even in its current state. It's basically the beginnings of a port of the Emacs ENSIME functionality over to jEdit. There is an existing plugin which attempts to do this in jEdit, but it embeds a modified version of ENSIME (and doesn't work post 2.8.1), so its usefulness is a bit diminished.
Right now, the following features work:
- Typecheck on save (with error underlines; warnings not supported yet)
- Inspect type under cursor (no special support for arrow types yet, so they look a little odd)
- Jump to declaration (my favorite!)
The big problem right now is the implementation is very machine specific (and specifically my machine). Again, this is largely because I need it for my own stuff and haven't gotten around to making it work for anyone else. The machine specific bits are documented in the README. Help here is also appreciated, especially if you're an SBT or a scala.sys.process guru. Or we can just leave it specific to my machine; works for me! :-)
Oh, another issue is that the plugin only maintains a single instance of ENSIME. That should be fixed soon, but until then, you will need to re-init ENSIME any time you switch to a file that's in a different project. Make sure you have a pre-existing .ensime file consisting of a single s-expression (no comments)!
No promises on maintenance here. As I said, I did this in anger since I really need this functionality for my own work. Any functions that I don't need (such as scaladoc lookup, debugging or file structure view) are unlikely to get implemented or maintained (in the event of someone else contributing an implementation). I'll maintain this exactly as long as I continue to use it myself. :-)
With all that said, enjoy!
Daniel










Re: jEdit ENSIME Thingy
On Tue, Aug 23, 2011 at 11:01 AM, Daniel Spiewak <djspiewak [at] gmail [dot] com> wrote:
Re: jEdit ENSIME Thingy
First, could you link to some SWANK protocol documentation from the ENSIME website? While telnet-heavy reverse engineering and source-code-reading is a really fun way to spend an afternoon, it's probably not the fastest way to implement tooling. All I really needed was the documentation on how exactly the sockets are used in SWANK and specifically how to send/receive an s-expression. Figuring that out actually required more than twice as much time as it took me to do the full implementation for "jump to declaration"!
Second, could you explain how exactly ENSIME server processes are meant to be juggled? This is one I haven't figured out yet. I have a vague notion that it's supposed to be one process per project (or subproject, as the case may be). How do you associate those processes (inside Emacs) with files that haven't been opened yet? I know how I would do it, but I'd rather mimic Emacs's semantics here.
Daniel
On Tue, Aug 23, 2011 at 11:43 AM, Aemon Cannon <aemoncannon [at] gmail [dot] com> wrote:
Re: jEdit ENSIME Thingy
On Tue, Aug 23, 2011 at 12:51 PM, Daniel Spiewak <djspiewak [at] gmail [dot] com> wrote:
Re: jEdit ENSIME Thingy
To send an s-expression, determine its ASCII length and then encode that integer as a padded six-digit hexadecimal value. Write this value to the output socket first, then followed by the ASCII form of the s-expression. Thus, the reader loop should read six ASCII characters into a buffer and convert that into an integer, then read that number of ASCII characters from the socket, parsing the result into an s-expression.
Basically, that's anyone would need. Some raw, telnet-able examples would be nifty too, but not necessary. The rest is API.
Ok, that makes sense. Thanks!
Daniel
Re: jEdit ENSIME Thingy
On Tue, Aug 23, 2011 at 1:45 PM, Daniel Spiewak <djspiewak [at] gmail [dot] com> wrote: