ENSIME
ENhanced Scala Interaction Mode for Emacs.
This project provides the Emacs support for the ENSIME server and currently shares the same issue tracker. This project is actively community maintained, and we are very pleased to see contributions from new members. Please visit the server's github page to find out more about how you can help.
ENSIME brings IDE-like features to your favourite text editor, such as:
- Show the
type
of the symbol under the cursor. - Contextual completion for
var
s,val
s anddef
s. - Add an import for the symbol under the cursor.
- Fast classpath search (types and members).
- Jump to source code or documentation.
- Browse packages and type hierarchies.
- Find all references to a symbol.
- Refactorings (rename, organize imports, extract method).
- REPL with stack trace highlighting.
- Errors and warnings in your code: red squigglies.
- Debugging
and many more.
Quick Start
There are two ways to install this extension. You can use MELPA (recommended):
;; if you're new to the MELPA package manager, include this in your `~/.emacs` file to add it
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
;; restart emacs and then do M-x package-install [RETURN] ensime [RETURN]
Or fork and clone this repository into a directory of your choice and
add it explicitly into your ~/.emacs
(developer front-end install, manual dependency management):
;; assuming you put the repository in ~/.emacs.d/ensime
(add-to-list 'load-path (concat user-emacs-directory "ensime"))
In either case, add the following to ~/.emacs
to enable ensime:
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
Much of the actual text editing is provided by the excellent scala-mode2, which can be customised.
Getting Started
A project needs to have a .ensime
configuration file. Luckily we
have a plugin for SBT projects
and maker
provides out-of-the-box support,
which will automatically create an appropriate .ensime
config.
The example .ensime
configuration documents the available entries and options.
We would love to receive user-contributed maven and ivy generators.
For best behaviour, the ENSIME server needs to be running the same
version of scala that your project uses. The default version of scala
is defined by ensime-default-scala-version
but you can specify
this per-project with :scala-version "2.9.3"
in .ensime
.
Then simply M-x ensime
and point it at your project config, which may download the latest ENSIME server for the specified version of scala.
If the download fails, or you want to use a specific version of the server, install the developer version following the instructions on
the ENSIME server github page.
Once the server is available, wait for the analyzer to complete and enjoy editing with the ENSIME commands that are conveniently summarised in our ENSIME Quick command reference (or read it straight from the source).
Emacs-wide customisations are defined in ensime-vars.el and will appear in M-x customize
.
Keeping up to date with releases is recommended. Melpa manages upgrading of
packages and if you're running from source you will need to
git pull --rebase upstream master
regularly.
Before reporting any problems with ENSIME, please:
- check the tickets flagged as FAQ.
- check the most recently updated tickets (others are probably talking about it already with workarounds).
- do a few keyword searches using the github search (top of the page) to see if anybody has reported this already.
Further Information
Although the ENSIME's options are fully documented in the emacs
customization pages (M-x customize RET "ensime"
), you may also wish to read the ENSIME User
Manual.
Older releases are bundled with the server.