ENSIME-Sublime provides Scala support to the Sublime Text editor, it is a bit rough round the edges, but is being actively worked on - watch this space.
N.b. SublimeText 2 (ST2) support is deprecated as all of the development is currently happening for Sublime Text 3 (ST3). If you are interest in ST2 support consider contributing to the Sublime Text 2 Branch
The project is up and functional and supports a subset of the Ensime features:
- error highlighting
- code completion (hit . followed by ctrl-space or command-space should work)
- goto definition
- type hints
- extract local, extract method
- add import, organize imports
- supports Scala 2.10 and 2.11
This is a work in progress, please do submit issues to our tracker.
Right now you need to jump through some hoops to get started - we are working on it.
- Ensure you have a jdk installed and visible on your path
- Ensure you have sbt installed and visible on your path
- Install Sublime Text 3 (if you do not have Sublime Text already installed).
- Install the ensime plugin from Package Control
or
-
Clone this project (let's refer to it as
$PLUGIN
). -
Manually install Ensime-Sublime
-
for Sublime Text 3:
Symlink~/Library/Application Support/Sublime Text 3/Packages/Ensime
(Mac) or/.config/sublime-text-3/Packages/Ensime
(Linux) to$PLUGIN
. -
Restart Sublime Text.
- Checkout your project (referred to as
$PROJECT
). - Add the Ensime sbt plugin to your user sbt configuration (recommended) or directly to the sbt project itself (see ensime-server wiki for details
- ignore the Emacs bits).
- Run
sbt gen-ensime
to create a.ensime
file.
- Open the Ensime plugin configuration at
Preference -> Package Settings -> Ensime -> Settings - User
. - Add the below entry to the file:
{
"connect_to_external_server": false,
}
Note that Ensime Server requires grealpath
utility (run e.g. brew install coreutils
to install it).
-
In Sublime Text create a new project with
$PROJECT
as a root (to do so: open a new window (Ctrl+Shift+N
for Windows/Linux andCmd+Shift+N
for Mac) and open$PROJECT
as a root). -
Open the Sublime command palette (typically bound to
Ctrl+Shift+P
on Windows/Linux andCmd+Shift+P
on Mac) and typeEnsime: Startup
.
With luck - if you open a Scala file in your project, you should have error highlighting (on save) and jump to definition working!
-
By default Ensime customizes mouse bindings. It makes
Ctrl+Click
/Cmd+Click
invokeGo to Definition
andAlt+Click
stand forInspect Type at Point
. If you want to disable these bindings or change them bindings to something else, adjust the config atPreferences > Package Settings > Mousemap - Default
. -
For Windows users, make sure the
Line Endings
setting is set toUnix
. You may do this by going toView > Line Endings
and selectingUnix
.
Open the Sublime command palette (typically bound to Ctrl+Shift+P
on Windows/Linux and Cmd+Shift+P
on Mac) and type Ensime: Startup
.
If you don't have an Ensime project, the plugin will guide you through creating it.
If you already have a project, an ENSIME server process will be started in the background,
and the server will initialize a resident instance of the Scala compiler.
After the server is ready, a message will appear in the left-hand corner of the status bar.
It will read either ENSIME
if the currently opened file belongs to the active Ensime project
or ensime
if it doesn't. Keep an eye on this message - it's an indicator of things going well.
If you find that some features of Ensime are not working properly (i.e. Go To Definition or Error Highlighting), then check the Line Endings
setting in Sublime Text. On Windows, the line endings is set to Windows
by default.
Simply change this setting to Unix
by going to View > Line Endings
and selecting Unix
.
Submit issues on the tracker or come find us on the ensime-sublime Gitter channel.