Working with the Atom ENSIME Source
The basic cycle for interactive hacking on Atom ENSIME is: checkout the project (or a fork), install the package from your fork. Then: make edits, re-load Atom, repeat. Feel free to chat on gitter, and send a pull request.
Checkout the project from: https://github.com/ensime/ensime-atom
Either checkout straight into .atom/packages (or
ln -sfrom there to your checkout). You need to have the right name on the folder: “Ensime”.
From that directory run:
In Atom: “Window: reload” (ctrl-option-cmd l) to reload plugin from source while developing. Then start ENSIME in Atom as usual.
View / Developer / Toggle Developer Tools gives you the usual console and other inspectors.
Developing ensime-client node package in parallel
When developing ensime-atom, chances are high you will most likely need to develop the node package ensime-client in parallel. This npm package was recently pulled out from ensime-atom to be a shared client lib for the node environment to use both in ensime-atom and a planned ensime-vscode.
To make the development smooth you will probably want to follow similar instructions as these:
Specific example of these follow.
Notice that as part of pulling these things out, the ensime-client is no longer depending on Atom’s automatic compilation of coffeescript. It instead uses grunt to compile the coffescript into js that is exported. Therefore you’ll need to set up a watch task as well.
git clone https://github.com/hedefalk/ensime-node
npm link(this creates a softlink from npm registry to this working directory)
apm rebuild(atom special sauce)
npm run watch(alias for grunt watch, but might replace for gulp)
On the ensime-atom side:
npm link ensime-client(this create a softlink from node_modules to the npm registry)
The npm link business is basically just this:
/Users/viktor/dev/projects/atom-ensime/node_modules/ensime-client -> /usr/local/lib/node_modules/ensime-client -> /Users/viktor/dev/projects/ensime-node
ensime-node is my checked out git repo.
Use server assembly jars
See the server docs if you need to build your own server.
Tricks and Tips
Access ENSIME from the console
In the developer console, you can look up the package like this:
e = atom.packages.getActivePackage('Ensime').mainModule
From there you can access other parts of the package. E.g.,
client = e.clientOfEditor(atom.workspace.getActiveTextEditor())
Inspiration (steal if you can)
- Atom Flight Manual - see Chapter 3, Hacking Atom in particular.
- ENSIME project source
- Swank Protocol source
- Jerk Formats
- Emacs command cheat sheet
- ENSIME Google Group
- Startup of server from Emacs
- Space pen
- Space pen views
- Find and replace