Awesome
The Sublime Elm Language Package
Installation
- Install Package Control
- Run
Package Control: Install Package
in the Command Palette (<kbd>Super+Shift+P</kbd>) - Install Elm or use NPM (
npm i -g elm
)
Features
- Compatible with Sublime Text 2 and Sublime Text 3
- Syntax highlighting
- Autocompletions plus type signature and documentation display for all functions inside packages in your
elm-package.json
file (requires elm-oracle, which you can install withnpm install -g elm-oracle
)- Bring up the type panel with
alt+up
or 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 (<kbd>Super+[Shift]+B</kbd> or <kbd>Super+[Shift]+F7</kbd>)
Build
just checks errors. Kudos to this tweet!Run
additionally outputs your compiled program to an inferred path.- The same as the above two, but ignoring warnings
- Output path is configurable in
elm-package.json
orElm 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 (<kbd>Super+[Shift]+F4</kbd>).
- 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-repl
in 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-format
is 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 -> User and add this setting:
"elm_format_on_save": true
- If there are certain Elm source files you don't want to automatically run
elm-format
on, 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-format
on the file when you save. For example, the following filter would prevent automaticelm-format
on a file namedelm-css/src/Css/TopBar.elm
:"elm_format_filename_filter": "elm-css/src/Css/.*\\.elm$"
- Make sure
Troubleshooting
- I have
elm-oracle
installed, but completions, type signature display, and the type panel don't work- Make sure
elm-oracle
is on your PATH, or - Add the absolute path of the directory containing
elm-oracle
to theelm_paths
setting in your Elm Language Support User settings
- Make sure
- I have
elm-format
installed, but it's not working- Make sure
elm-format
is on your PATH, or - Add the absolute path of the directory containing
elm-format
to theelm_paths
setting 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-format
on, 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-format
on the file when you save. For example, the following filter would prevent automaticelm-format
on 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!
Coming Soon
The following features are being worked on next:
- Built in
elm-package
support. Install packages, open docs in the browser, and pull package stats from GitHub - Improved snippets to help with common patterns. Create a new Elm Architecture project or submodule with a basic skeleton in just a few keystrokes. Less manual boilerplate
If there's any features you'd like to see, send me an email!