Skip to content

Latest commit

 

History

History
179 lines (150 loc) · 1.96 KB

snippets.md

File metadata and controls

179 lines (150 loc) · 1.96 KB

Snippets

This is a list of supported snippets provided by this plugin.

test⇥ test

use v6;
use Test;
${1:use lib 'lib';}
plan ${2:$num-tests};

switch⇥ switch

given ${1:$var} {
  when ${2:condition} {
    ${3:# code block ...}
  }
  ${4}
  default {
    ${5}
  }
}

tc⇥ tc

${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false};

eif⇥ eif

elsif ${1) {
  ${2}
}

ife⇥ ife

if ${1} {
  ${2}
}
else {
  ${3}
}

mth⇥ mth

method ${1:method_name}(${2:$attr}) {
  ${3}
}

has⇥ has

has ${1:Type} ${2:$!identifier};

unless⇥ unless

unless ${1} {
  ${2}
}

rfile⇥ rfile

for "${1:filename}".IO.lines -> $line {
  ${2}
}

pmth⇥ pmth

method ${1:!}${2:method_name}(${3:$attr}) {
  ${4}
}

rp⇥ rp

repeat {
  ${1}
} ${2:while|until} ${3};

loop⇥ loop

loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) {
  ${3}
}

mul⇥ mul

multi ${1:function_name}(${2:Str $var}) {
  ${3}
}

slurp⇥ slurp

my ${1:$var} = "${2:filename}".IO.slurp;

smth⇥ smth

submethod ${1:submethod_name}(${2:$attr}) {
  ${3}
}

#!⇥ #!

#!/usr/bin/env perl6

cl⇥ cl

${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{
  ${4}
}

for⇥ for

for ${1:@array} -> ${2:$variable} {
  ${3}
}

xif⇥ xif

${1:expression} if ${2:condition};

sub⇥ sub

sub ${1:function_name}(${2:Str $var}) {
  ${3}
}

pod⇥ pod

=begin pod
$1
=end pod

script⇥ script

#!/usr/bin/env perl6

use v6;

say "Hello world";

wh⇥ wh

while ${1} {
  ${2}
}

xunless⇥ xunless

${1:expression} unless ${2:condition};

if⇥ if

if ${1} {
  ${2}
}