Quick compile builds for Elixir in VSCode

Joel Kemp
Joel Kemp
Sep 12 · 2 min read

When you’re making changes in VSCode and you want a quick check to make sure the project compiles, you can either reach for a terminal and type mix compile or set up a quick build in VSCode and trigger it via a keyboard shortcut. I’ll show you how to set up the latter.

  • Look for a .vscode folder in your project (or create one)
  • Look for a tasks.json file in your .vscode directory or create that file
  • Insert the following task configuration in that file:
"version": "2.0.0",
"tasks": [
"label": "mix: compile",
"type": "shell",
"command": "mix compile",
"group": {
"kind": "build",
"isDefault": true
"problemMatcher": []
  • Note: If you already have a task in there, then just append the object in the tasks array above to your existing tasks array.
  • Save the file. You shouldn’t need to restart VSCode for it to take effect, but try that if the next steps don’t work.
  • Trigger the command using Terminal -> Run Build Task, or the keyboard shortcut attached to that (mine is Shift + CMD + B, on Mac).
  • You should then see a terminal window pop up in your editor with text similar to the following (with “tictactoe” being whatever your app is named, of course):
Image for post
Image for post

Now, anytime you need a quick sanity check that your code still compiles and doesn’t have any big errors, trigger that build task using your keyboard shortcut. It should speed up your development cycle a touch.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store