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)

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.


Thanks, feels like a personal favor :slight_smile: