Here are some useful snippets for Elixir development in VS Code:

{
    // Place your snippets for elixir here. Each snippet is defined under a snippet name and has a prefix, body and
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
    // same ids are connected.
    // Example:
    // "Print to console": {
    //     "prefix": "log",
    //     "body": [
    //         "console.log('$1');",
    //         "$2"
    //     ],
    //     "description": "Log output to console"
    // }
  "inpsect": {
        "prefix": "lin",
        "body": "IO.inspect($1, label: \"$1\", pretty: true)",
        "description": "IO.inspect with label."
    },
    "inpsectSelectedText": {
        "prefix": "sin",
        "body": "IO.inspect($TM_SELECTED_TEXT, label: \"${TM_SELECTED_TEXT/(.*)/${1:/upcase}/}$0\", pretty: true)",
        "description": "IO.inspect with selected text as label."
    },
    "pipeInspect": {
        "prefix": "pin",
        "body": "|> IO.inspect(label: \"$1\", pretty: true)",
        "description": "IO.inspect with selected text as label."
    },
    "pipeInspectWithFileReference": {
        "prefix": "pinf",
        "body": "|> IO.inspect(label: \"$TM_FILEPATH:$TM_LINE_NUMBER$0\", pretty: true)",
        "description": "IO.inspect with selected text as label."
    },
    "inspectFromClipboard": {
        "prefix": "cin",
        "body": "IO.inspect($CLIPBOARD, label: \"${CLIPBOARD/(.*)/${1:/upcase}/}$0\", pretty: true)",
        "description": "IO.inspect clipboard content."
    },
    "tagThis": {
        "prefix": "this",
        "body": "@tag :this$0",
        "description": "Add `@tag :this` for testing purposes"
    },
    "insertMap": {
        "prefix": "m",
        "body": "%{$1: $1$0}",
        "description": "Insert map with double cursor both for key and value`"
    },
    "fastElixirMap": {
        "prefix": "k",
        "body": "$1: $1$0",
        "description": "Fast map creation using the key as value as well `%{foo: foo}`"
    },
    "insertLabel": {
        "prefix": "l",
        "body": "label: \"$1\"",
        "description": "insert `label` option to use in IO.inspect"
    },
    "insertInfinityOptions": {
        "prefix": "inf",
        "body": "limit: :infinity, printable_limit: :infinity$0",
        "description": "configure IO.inspect to show EVERYTIHNG"
    },
    "pipeFile": {
        "prefix": "pf",
        "body": "|> Jason.encode!() |> then(& File.write!(\"./output_$CURRENT_SECONDS_UNIX.json$0\", &1))",
        "description": "Serialize the content into JSON file (assuming that Jason installed and content serializable)."
    }
}

To install them:

  1. Open the command palette (cmd + shift + p)
  2. Select "Snippets: configure snippets"
  3. Select "Elixir" as the language
  4. Paste in the json above

To use the snippets, either type the prefix in the editor or use the option "Snippets: insert snippet" from the command palette.

When you want to learn more about using snippets in VS Code, the documentation is your friend.