brentjanderson

brentjanderson

ECTO_EDITOR with Visual Studio Code

ECTO_EDITOR is a cool feature within ecto_sql. From the docs:

This generator will automatically open the generated file if you have ECTO_EDITOR set in your environment variable.

Until now, I hadn’t gotten it to work. But, researching for this post I figured it out. If you add the following to your .bashrc or .zshrc file, Ecto will conveniently open your editor for you:

export ECTO_EDITOR="code -rg"
# the -r flag tells it to reuse the current window
# the -g flag tells it to go to the line number specified

This assumes you have installed VS Code’s CLI tool on your PATH.
For Mac, look here: Installing Visual Studio Code on macOS
For other platforms, I think it’s automatically set up for you.

Hopefully this helps someone else that’s looking to fine tune their Ecto + VS Code integration!

Most Liked

cpgo

cpgo

There is also PLUG_EDITOR

Where Next?

Popular in Discussions Top

scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New

We're in Beta

About us Mission Statement