An Atom package for Elixir
Autocomplete, Go/Jump to Definition, Documentation and more.
Dependencies
Install
apm install atom-elixir
Features
- Autocomplete (Screenshots)
- Lists modules, functions, variables, function params and module attributes available in the current scope.
- Lists callbacks defined in behaviours (works also when @behaviour is injected by
use
directives)
- Lists the accepted "returns" specs when inside a callback implementation
- Indicates the type of the module (Module, Struct, Protocol, Implementation or Exception)
- Shows documentation summary for each module or function
- Shows function and callback specs
- Works with aliased and imported modules
- Indicates where the function was originally defined (for aliased, imported modules or callbacks)
- Smart snippets for functions: After
|>
, doesn't write first parameter. After &
, writes &function/arity
- Go to definition
- Jump to the definition of the module or function under the cursor
- Erlang modules and functions also supported
- Return from definition (to previous files/positions)
- Works with aliased and imported modules
- Documentation View (Screenshots)
- Shows documentation of the module or function under the cursor
- Also shows specs, types and callbacks (when available)
- Works with aliased and imported modules
- Quoted Code view (Screenshots)
- Convert selected text into its quoted form
- Live pattern matching against quoted code
- Expand Macro view (Screenshots)
- Expands the selected macro. Shows expanded code using Expand Once, Expand and Expand All.
- All features depending on aliases and imports are already supporting the new v1.2 notation.
IMPORTANT: Most of the features only work properly if you have the related .beam
files in the project's _build
folder. So please, before opening an issue, make sure you can successfully compile your project in the environment you're trying to use it ("dev" and/or "test"). You can also hit ALT+CMD+i
to open the Atom's console (ALT+CTRL+i on windows/linux) in order to see the server's output. When successfully started, atom-elixir prints:
[atom-elixir] Initializing ElixirSense server for environment "dev" (Elixir version 1.4.0)
[atom-elixir] Working directory is "/Users/your_name/workspace/your_project/"
All error messages from the server should also be displayed in the console. Please send those messages when reporting an issue.
Shortcuts
- Autocomplete:
ctrl + space
- Go To Definition:
alt + down
or alt + click
- Return from Definition:
alt + up
- Go To Documentation:
F2
- Open Quoted Code View + quote selected text:
ctrl + shift + t
- Open Expand Code View + expand selected text:
ctrl + shift + x
Notice: The keymaps were defined for my own OS X environment. If you're using Linux, Windows or even another OS X environment and the current key mapping conflicts with other commands, feel free to open an issue and report it.
Screenshots
Autocomplete
- Listing variables, module attributes, functions and macros available in the current scope
- Showing specs and documentation summary
- Showing where each function was originally defined
- Listing callbacks defined in used behaviours
- Listing accepted "returns" when inside a callback implementation
Documentation
- Showing documentation of the module/function under the cursor
- Showing documentation of the module under the cursor (callbacks)
Expand Macro View
- Expanding selected macro call
Quoted Code View
- Quoted form of the selected code
- Live pattern matching against quoted code
Credits
- The Elixir Server is an extended version of alchemist-server by Samuel Tonini. Pay attention that the current API is no longer compatible with the original one.
- The Expand View was inspired by the mex tool by Luc Fueston. There's also a very nice post where he describes the whole process of Building A Macro-Expansion Helper for IEx.