Last active
August 24, 2018 04:25
-
-
Save sleepiecappy/a01333004017eee8e63125bee56bddf0 to your computer and use it in GitHub Desktop.
VSCode Elixir Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Module definition": { | |
"prefix": "mod", | |
"body": [ | |
"defmodule $1 do", | |
" $0", | |
"end" | |
] | |
}, | |
"Function definition": { | |
"prefix": "def", | |
"body": [ | |
"def $1 do", | |
" $0", | |
"end" | |
], | |
}, | |
"Function definition (private)": { | |
"prefix": "defp", | |
"body": [ | |
"defp $1 do", | |
" $0", | |
"end" | |
], | |
}, | |
"Function definition (inline)": { | |
"prefix": "idef", | |
"body": "def $1, do: $0" | |
}, | |
"Function definition (inline & private)": { | |
"prefix": "idefp", | |
"body": "defp $1, do: $0" | |
}, | |
"Struct definition": { | |
"prefix": "defs", | |
"body": [ | |
"defstruct do", | |
" $0", | |
"end" | |
], | |
}, | |
"Protocol definition": { | |
"prefix": "proto", | |
"body": [ | |
"defprotocol $1 do", | |
" $0", | |
"end" | |
], | |
}, | |
"Protocol implementation": { | |
"prefix": "impl", | |
"body": [ | |
"defimpl $1, for: ${2:Any} do", | |
" $0", | |
"end" | |
], | |
}, | |
"Function documentation": { | |
"prefix": "doc", | |
"body": [ | |
"@doc \"\"\"", | |
"$0", | |
"\"\"\"" | |
] | |
}, | |
"Module documentation": { | |
"prefix": "mdoc", | |
"body": [ | |
"@moduledoc \"\"\"", | |
"$0", | |
"\"\"\"" | |
] | |
}, | |
"Type documentation": { | |
"prefix": "tdoc", | |
"body": [ | |
"@typedoc \"\"\"", | |
"$0", | |
"\"\"\"" | |
] | |
}, | |
"Type declaration": { | |
"prefix": "type", | |
"body": "@type ${1:t()} :: $0" | |
}, | |
"GenServer": { | |
"prefix": "gens", | |
"body": [ | |
"defmodule $1 do", | |
" use GenServer", | |
" ", | |
" def start_link(${2:_args}) do", | |
" ", | |
" end", | |
" ", | |
" def init(${3:_args}) do", | |
" {:ok, state}", | |
" end", | |
"end" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment