How would you enable the browser to auto-open the editor?

In the ElixirConf talk “Phoenix Field Notes” at 29:00, Chris McCord shows a nice trick where he clicks on an element in the browser, and the VsCode editor auto-opens to the component that generated the element. Wow!

When file-location annotations are available, how would you enable the browser to auto-open the editor? Is this something that would be done in a browser configuration, or would it be a JS concern built into phoenix.js, or something else? How would you select the editor? (Neovim vs VsCode vs …)

1 Like

We’ll use your configured ELIXIR_EDITOR, (which is what iex’s open/1 does already (check it out!)), and then on the server we just call System.cmd taking your ELIXIR_EDITOR and feeding it the file/line like iex does. Any editor with a cli that supports files/line args should work. ie here’s mine :slight_smile:

ELIXIR_EDITOR='code-insiders -g __FILE__:__LINE__ --reuse-window'

There was a thread about it here: Made a Source Code Inspector, useful in big projects or large teams