IEx.Helpers.open
open
, go back to IEx.Helpers module for more information.
Opens the given module
, module.function/arity
, or {file, line}
.
This function uses the ELIXIR_EDITOR
environment variable
and falls back to EDITOR
if the former is not available.
By default, it attempts to open the file and line using the
file:line
notation. For example, if your editor is called
subl
, it will open the file as:
subl path/to/file:line
It is important that you choose an editor command that does not block nor that attempts to run an editor directly in the terminal. Command-line based editors likely need extra configuration so they open up the given file and line in a separate window.
Custom editors are supported by using the __FILE__
and
__LINE__
notations, for example:
ELIXIR_EDITOR="my_editor +__LINE__ __FILE__"
and Elixir will properly interpolate values.
Since this function prints the result returned by the editor,
ELIXIR_EDITOR
can be set "echo" if you prefer to display the
location rather than opening it.
Keep in mind the location may not exist when opening precompiled source code.
Examples
iex> open(MyApp)
iex> open(MyApp.fun/2)
iex> open({"path/to/file", 1})