A bag of tricks for developing with Elm.
https://atom.io/packages/elmjutsu
-
- Show type hints and documentation for the symbol at cursor position.
- Elm
- language-elm (no need to install elm-oracle)
- For
Go To Definition
:- hyperclick (optional)
- For
Autocomplete
:- autocomplete-plus (installed by default)
- snippets (optional, installed by default)
By default, the only thing this package does is parse your project's source files to extract information, and download documentation of 3rd-party Elm packages. You have to manually enable the features that you need. The downloaded documentation files will be saved to the path set in Cache Directory
in the settings view. If Cache Directory
is blank, a temporary directory will be used. Take note that most operating systems delete temporary directories at bootup or at regular intervals.
Autocomplete is turned off by default. To turn it on, check Enable Autocomplete
in the package settings.
This provides suggestions for imports, project symbols, and 3rd-party package symbols.
- It's recommended to uncheck
Enable autocomplete
of the language-elm package to prevent duplicate suggestions.
- Check
Enable Global Autocomplete
if you want include unimported project symbols. This will also enable "Auto import" autocompletion.
- You can also check
Enable Autocomplete Snippets
if you prefer.
- Special completions:
Press tab to go to the next tab stop (similar to how snippets work).
If the hyperclick package is installed, you can also check Enable Hyperclick
to jump to definition using Ctrl
+ click / Cmd
+ click (Mac).
Moves the cursor to the position of the next usage.
Moves the cursor to the position of the previous usage.
The current cursor position is added to a navigation stack before jumping via:
Go To Definition
Go To Symbol
Go To Next Usage
Go To Previous Usage
Invoke this command to jump back to the previous position.
Renames the symbol across the whole project. Take note that this is not an undoable operation.
- Press enter to rename or escape to cancel.
- Uncheck usages to exclude.
- Modified modules with open editors will not be saved automatically.
- Renaming a module will not rename the associated file.
- Currently, this also modifies the symbol name inside comments.
Closes the Usages
panel (the panel is shown after invoking Find Usages
or Rename Symbol
).
Quickly adds an import without scrolling to the top of the file. Also sorts the imports, removes duplicates, and removes defaults automatically.
Shows the type hints and documentation for the symbol at cursor position. The size and position of the panel can be modified in the package settings.
- Example #1 (default):
Sidekick Position
= "bottom",Sidekick Size
= 0 (Automatically resizes to fit content.)
- Example #2:
Sidekick Position
= "bottom",Sidekick Size
= 30 (Just shows the type hints.)
- Example #3:
Sidekick Position
= "right",Sidekick Size
= 300
Quickly installs a package.
- This runs
elm-package install --yes <name> <version>
(orelm-package install --yes <name>
if the selected version is "Auto"). - Make sure that
Elm Package Path
is properly configured in the package settings.
Removes an installed package.
- This removes the dependency from
elm-package.json
, then runselm-package install --yes
to clean up.
Here is an example:
'atom-text-editor:not([mini])[data-grammar^="source elm"]':
'f12': 'elmjutsu:go-to-definition'
'ctrl-r': 'elmjutsu:go-to-symbol'
'shift-f12': 'elmjutsu:find-usages'
'f8': 'elmjutsu:go-to-next-usage'
'shift-f8': 'elmjutsu:go-to-previous-usage'
'ctrl-f12': 'elmjutsu:go-back'
'f2': 'elmjutsu:rename-symbol'
'alt-insert': 'elmjutsu:add-import'
'atom-workspace':
'f1': 'elmjutsu:toggle-sidekick'
'ctrl-shift-f12': 'elmjutsu:hide-usages-panel'
'atom-text-editor':
'alt-enter': 'elmjutsu:eval'
'ctrl-enter': 'elmjutsu:pipe-selections'
'.elmjutsu-pipe-selections':
"ctrl-enter": "elmjutsu:apply-pipe-selections"
Add them to your keymap.cson
or bind them from Settings
> Keybindings
.
- Be sure to check out the settings for this package to find out about the available options.
- It's highly recommended to read
CHANGELOG.md
before upgrading to a newer version to check for breaking changes. - The commands only work for top-level values for now.
- You may encounter weird behaviors if multiple files are using the same module name in your project.
- Major parts of this will be rewritten when a way to get the AST becomes available. Also, more features :)