Elm is a an amazing way to build web applications that guarantees no runtime exceptions and blazingly fast rendering.
This is a path -one of many possible- to start Elm development.
Step One – Get the Right Tools.
Sublime is my editor of choice. Amazingly fast and extensible.
First, a few general tweaks
-
Enable Go to Definition on Ctrl + Mouse
Create a new file – “Default (Windows).sublime-mousemap” – in %appdata%\Sublime Text 3\Packages\User
With the following content:
[
{
“button”: “button1”,
“count”: 1,
“modifiers”: [“ctrl”],
“press_command”: “drag_select”,
“command”: “goto_definition”
}
]
More details on Linux and Mac here -
Add a shortcut for locating a file in the file tree sidebar.
Go to Preferences -> Key Bindings-User and add:
{ “keys”: [“alt+shift+l”], “command”: “reveal_in_side_bar” } - Pick a different theme, if you’d like – soda-theme.
- Install Sublime Package Control to enable easy package installation – Package Control
Now, some Elm-specific changes.
- Install Elm Language Package
- Install elm-oracle to enable autocompletions.
- Install Highlight Build Errors from Sublime Package Control
-
Install elm-format to enable auto-formatting. Just download the zip and add the executable to the path to make it work.
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
When you work with elm files, you can press Ctrl+B to build it. If there are any errors or warnings, they will show up in the console below and also get highlighted.
If you want to see the definition of a method, press Alt+Up while your cursor is on the method.