diff --git a/snippets/elixir.snippets b/snippets/elixir.snippets new file mode 100644 index 0000000..449071c --- /dev/null +++ b/snippets/elixir.snippets @@ -0,0 +1,93 @@ +snippet if if .. do .. end + if ${1} do + ${2} + end + +snippet if if .. do: .. + if ${1:condition}, do: ${2} + +snippet ife if .. do .. else .. end + if ${1:condition} do + ${2} + else + ${3} + end + +snippet ife if .. do: .. else: + if ${1:condition}, do: ${2}, else: ${3} + +snippet case + case ${1} do + match: ${2} + ${3} + end + +snippet def + def ${1:name} do + ${2} + end + +snippet defim + defimpl ${1:protocol_name}, for: ${2:data_type} do + ${3} + end + +snippet defma + defmacro ${1:name} do + ${2} + end + +snippet defmo + defmodule ${1:module_name} do + ${2} + end + +snippet defp + defp ${1:name} do + ${2} + end + +snippet defpr + defprotocol ${1:name}, [${2:function}] + +snippet defr + defrecord ${1:record_name}, ${2:functions} + +snippet doc + @doc """ + ${1} + """ + +snippet fn + fn(${1:args}) -> ${2} end + +snippet loop + loop ${1:values}, ${2:initial} do + match: ${3} + ${4} + end + +snippet mdoc + @moduledoc """ + ${1} + """ + +snippet rec + receive do + match: ${1} + ${2} + end + +snippet req + require ${1:module_name}, as: ${2:alias} + +snippet test + test "${1:test_name}" do + ${2} + end + +snippet try + try do + catch: ${1} + ${2} + end