SublimeElmLanguageSupport
SublimeElmLanguageSupport copied to clipboard
Elm language syntax highlighting and tool integration for ST2/3.
This project is deprecated. The official Elm language support package for Sublime Text is evancz/elm-syntax-highlighting, with elm-format support available via evancz/elm-format-on-save.

The Sublime Elm Language Package
Note: Elm 0.19 and Elm Language Support
Elm 0.19 was recently released. It makes major, breaking changes to the compiler's interface with packages like this one. It is likely the next release of Elm Language Support will break compatibility with Elm 0.18.
If you plan to remain on Elm 0.18 for now, you should configure Package Control to ignore updates to this package until you are ready to upgrade. In Sublime Text, choose Preferences > Package Settings > Package Control > Settings – User, then add this setting to your Package Control.sublime-settings file:
{ "auto_upgrade_ignore": [ "Elm Language Support" ], }Upgrading to Elm 0.19
A pre-release version of this package with experimental support for Elm 0.19 is available. If you're using Elm 0.19 already, we'd value your feedback!
Warning: This new version does not support Elm 0.18!
To upgrade, configure Package Control to install pre-release versions of this package. In Sublime Text, choose Preferences > Package Settings > Package Control > Settings – User, then add this setting to your Package Control.sublime-settings file:
{ "install_prereleases": [ "Elm Language Support" ], }Then use the Package Control: Upgrade Package command in the Command Palette to upgrade. Make sure to read the release notes that are displayed following the upgrade!
Installation
- Install Package Control
- Run
Package Control: Install Packagein the Command Palette (Super+Shift+P) - Install Elm or use NPM (
npm i -g elm)
Manual
- Go to Packages directory
- Clone the repository
git clone https://github.com/elm-community/SublimeElmLanguageSupport.git 'Elm Language Support'
Features
- Compatible with Sublime Text 2 and Sublime Text 3
- Syntax highlighting
- Snippets for common Elm syntax (function,
case…of,let…in, etc.)
| Tab Trigger | Description |
|---|---|
| cof | case … of |
| cofm | case … of (Maybe) |
| cofr | case … of (Result) |
| debug | Debug.log |
| fn | Function (a -> b) |
| fn2 | Function (a -> b -> c) |
| fn3 | Function (a -> b -> c -> d) |
| fn4 | Function (a -> b -> c -> d -> e) |
| imp | import |
| impas | import … as |
| let | let … in … |
| mod | module |
| type | type |
| typea | type alias (Record) |
- Autocompletions plus type signature and documentation display for all functions inside packages in your
elm-package.jsonfile (requires elm-oracle, which you can install withnpm install -g elm-oracle)- Bring up the type panel with
alt+upor through the right-click context menu - Close the type panel with
alt+down - If you don't like these keybindings, rebind them in your User packages directory



- Bring up the type panel with
- Four standard build commands (Super+[Shift]+B or Super+[Shift]+F7)
Buildjust checks errors. Kudos to this tweet!Runadditionally outputs your compiled program to an inferred path.- The same as the above two, but ignoring warnings
- Output path is configurable in
elm-package.jsonorElm Build System: …in the Command Palette. Elm build system only requires a valid config in any ancestor directory of the active file.
- Compile messages
- Navigate errors and warnings (Super+[Shift]+F4).
- Formatted for build output panel.
- Compile message highlighting, embedded code highlighting, and color scheme for output panel.

- Integration with popular plugins (installed separately)
- SublimeREPL — Run
elm-replin an editor tab with syntax highlighting.
- Highlight Build Errors — Does what it says on the box … usually.
- SublimeREPL — Run
- Integration with elm format
- Make sure
elm-formatis in your PATH - Run the "Elm Language Support: Run elm-format" command from the Command Palette to run elm-format on the current file
- To enable automatic formatting on every save, Go to Preferences -> Package Settings -> Elm Language Support -> Settings and add this setting:
"elm_format_on_save": true - If there are certain Elm source files you don't want to automatically run
elm-formaton, for example elm-css based files, you can set a regex filter which will search the full filename (including the path to the file). If the regex matches, then it will not automatically runelm-formaton the file when you save. For example, the following filter would prevent automaticelm-formaton a file namedelm-css/src/Css/TopBar.elm:"elm_format_filename_filter": "elm-css/src/Css/.*\\.elm$"
- Make sure
Troubleshooting
- I have
elm-oracleinstalled, but completions, type signature display, and the type panel don't work- Make sure
elm-oracleis on your PATH, or - Add the absolute path of the directory containing
elm-oracleto theelm_pathssetting in your Elm Language Support User settings
- Make sure
- I have
elm-formatinstalled, but it's not working- Make sure
elm-formatis on your PATH, or - If using an alternate name for the binary (
elm-format-0.17orelm-format-0.18) add it to theelm_format_binarysetting in your Elm Language Support User settings; an example might be"elm_format_binary": "elm-format-0.18",, or - Add the absolute path of the directory containing
elm-formatto theelm_pathssetting in your Elm Language Support User settings. Note that you can combine paths with the above, so an example might be"elm_paths": "/users/alex/elm-format:/users/alex/elm-oracle"
- Make sure
- Elm format automatically runs every time I save a file, but there are some files I don't want it to run on
- If there are certain Elm source files you don't want to automatically run
elm-formaton, for example elm-css based files, you can set a regex filter which will search the full filename (including the path to the file). If the regex matches, then it will not automatically runelm-formaton the file when you save. For example, the following filter would prevent automaticelm-formaton a file namedelm-css/src/Css/TopBar.elm:"elm_format_filename_filter": "elm-css/src/Css/.*\\.elm$"
- If there are certain Elm source files you don't want to automatically run
Learning
Don't know Elm? Great first step!