MIX_TARGET in ElixirLS/VSCode >= 0.5.0

The latest ElixirLS release (v0.5.0) includes a little known change that makes a huge impact to the Nerves community - MIX_TARGET support!

What does this mean?

Well, have you ever scoped a dependency to a target for your Nerves project? (the answer is yes because systems do this by default :wink:). Something like:
{:cowsay, "~> 0.0.1", targets: :rpi3}

Then in your favorite editor, you use a module from that dep and get some unsavory lines stating that the ā€œmodule is not availableā€ Ā¬

Or, your mix.exs explodes with red lines and cryptic errors in the dependencies Ā¬

Thats because the ElixirLS process in the background was unable to resolve the context of a MIX_TARGET which meant any deps scoped to that target were totally missing because mix didnā€™t know to fetch them.

But no more! :tada:

Now you can set a mixTarget setting for the server to use when its going through deps resolution. In VSCode, this is a simple ElixirLS setting (elixirLS.mixTarget)
image

And thatā€™s it - Now sit back, enjoy a mimosa :tropical_drink:, maybe dance a little :dancer: :man_dancing:, and watch the red lines disappear from your project! (well, at least the ones caused by MIX_TARGET :wink:)

Check out the ElixirLS Changelog v0.5.0 section for details of other features in this update.

6 Likes

Thanks, feels like a personal favor :slight_smile: