Skip to content

jamilabreu/vscode-phoenix-snippets

Repository files navigation

Phoenix Snippets

Working on a Phoenix/Elixir project?

Get up and running faster on VS Code with code snippets for Elixir, Phoenix, and Phoenix LiveView (.ex, .html.eex, .html.leex).

Supported languages

  • elixir (.ex)
  • html-eex (.html.eex, .html.heex, .html.leex)

Snippets

Check out the snippet files on Github for an up-to-date list of snippets.

Shortcuts

Within .html.eex:

To create... Use shortcut
<%= ___ %> e=
<%= case ___ do %> case
<%= cond do %> cond
<% else %> else
<% end %> =e
<%= for ___ <- ___ do %> for
<%= form_for ___, Routes.____path(@conn, ___)}, ___, fn f -> %> ff
<%= error_tag ___, ___ %> et
<%= label ___, ___, "___" %> la
<%= password_input ___, ___ %> pi
<%= submit ___ %> sub
<%= text_input ___, ___ %> ti
<%= if ___ do %> if
<%= link "___", to: ___ %> lt
<%= link to: ___ do %> ltb
<%= render "___.html", ___ %> render
<%= unless ___ do %> unless
<%= f = form_for ___, "#", [phx_change: :validate, phx_submit: :submit] %> ffl
<%= live_patch "___", to: Routes.____path(@socket, ___) %> lp
<%= live_patch to: Routes.____path(@socket, ___) do %> lpb
<%= live_redirect "___", to: Routes.____path(@socket, ____) %> lr
<%= live_redirect to: Routes.____path(@socket, ___) do %> lrb

Within ordinary Elixir code:

To create... Use shortcut
inspect(___) i
IO.inspect(___) io
IO.inspect(___, label: "___") iol
defmodule ___Web.___ do plug
defmodule ___Web.___Controller do co
defmodule ___Web.___Live do lv
defmodule ___Web.___Component do lc
defmodule ___Web.___View do" vi
~L""" sl
assign(socket, ___: ___) a
def handle_event("___", ___, socket) do he
def handle_info("___", socket) do hi
def handle_params(params, _url, socket) do hp
def render(assigns) do\n\t~L""" re
def render(assigns) do\n\tPhoenix.View.render(___Web.___View, "___.html", assigns) ret

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •