Skip to content

Commit

Permalink
Merge branch 'master' of github.com:slackhq/vscode-hack
Browse files Browse the repository at this point in the history
  • Loading branch information
PranayAgarwal committed May 19, 2020
2 parents 9b45597 + 9232b54 commit be091ab
Showing 1 changed file with 13 additions and 37 deletions.
50 changes: 13 additions & 37 deletions snippets/hack.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,32 @@
{
".source.hack": {
"$GLOBALS['…']": {
"prefix": "globals",
"body": "$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}$0"
},
"function __construct": {
"prefix": "con",
"body": "function __construct(${1:$${2:foo} ${3:= ${4:null}}}) {\n\t${2:$this->$0 = $$0;}$0\n}"
},
"Heredoc": {
"prefix": "<<<",
"body": "<<<${1:HTML}\n${2:content here}\n$1;\n"
"body": "${1:public} function __construct($2) {\n\t${3:# code...;}$0\n}"
},
"Class Variable": {
"prefix": "doc_v",
"body": "/**\n * ${3:undocumented class variable}\n *\n * @var ${4:string}\n **/\n${1:var} $$2;$0"
"body": "/**\n * ${4:undocumented class variable}\n */\n${1:private} ${2:type} $${3:name};$0"
},
"Start Docblock": {
"prefix": "/**",
"body": "/**\n * $0\n */"
},
"class …": {
"prefix": "class",
"body": "/**\n * $1\n */\nclass ${2:ClassName} ${3:extends ${4:AnotherClass}}\n{\n\t$5\n\tfunction ${6:__construct}(${7:argument})\n\t{\n\t\t${0:# code...}\n\t}\n}\n"
"body": "/**\n * $1\n */\nclass ${2:ClassName} ${3:extends ${4:AnotherClass}} {\n\t${5:public} function ${6:__construct}($7) {\n\t\t${0:# code...}\n\t}\n}\n"
},
"trait …": {
"prefix": "trait",
"body": "/**\n * $1\n */\ntrait ${2:TraitName}\n{\n\tfunction ${3:functionName}(${4:argument})\n\t{\n\t\t${5:# code...}\n\t}\n}\n"
"body": "/**\n * $1\n */\ntrait ${2:TraitName} {\n\tfunction ${3:functionName}($4): $5 {\n\t\t${6:# code...}\n\t}\n}\n"
},
"const _ _ = _": {
"prefix": "const",
"body": "const ${1:type} ${2:name} = ${3:value};\n$0"
},
"define(…, …) >> Prefer const": {
"prefix": "def",
"body": "define('$1', ${2:'$3'});\n$0"
},
"defined(…)": {
"prefix": "def?",
"body": "$1defined('$2')$0"
},
"do … while …": {
"prefix": "do",
"body": "do {\n\t${0:# code...}\n} while (${1:$a <= 10});"
"body": "do {\n\t${0:# code...}\n} while (${1:\\$a <= 10});"
},
"echo \"\"": {
"prefix": "echo",
Expand All @@ -58,15 +42,15 @@
},
"for …": {
"prefix": "for",
"body": "for ($${1:i}=${2:0}; $${1:i} < $3; $${1:i}++) { \n\t${0:# code...}\n}"
"body": "for ($${1:i} = ${2:0}; $${1:i} < $3; $${1:i}++) { \n\t${0:# code...}\n}"
},
"foreach …": {
"prefix": "foreach",
"body": "foreach ($${1:variable} as $${2:key} ${3:=> $${4:value}}) {\n\t${0:# code...}\n}"
},
"function …": {
"prefix": "func",
"body": "${1:public }function ${2:FunctionName}(${3:$${4:value}${5:=''}})\n{\n\t${0:# code...}\n}"
"body": "${1:public }function ${2:functionName}(${3:$${4:value}${5:=''}})\n{\n\t${0:# code...}\n}"
},
"if … else …": {
"prefix": "ifelse",
Expand All @@ -78,27 +62,19 @@
},
"$… = ( … ) ? … : …": {
"prefix": "if?",
"body": "$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;"
},
"$… = array (…)": {
"prefix": "array",
"body": "$${1:arrayName} = array('$2' => $3${4:,} $0);"
},
"$… = […]": {
"prefix": "shorray",
"body": "$${1:arrayName} = ['$2' => $3${4:,} $0];"
"body": "$${1:retVal} = (${2:condition}) ? ${3:\\$a} : ${4:\\$b} ;"
},
"… => …": {
"prefix": "keyval",
"body": "'$1' => $2${3:,} $0"
},
"require_once …": {
"prefix": "req1",
"body": "require_once '${1:file}';$0"
"body": "require_once '${1:file}';\n$0"
},
"return": {
"prefix": "ret",
"body": "return$1;$0"
"body": "return $1;$0"
},
"return false": {
"prefix": "ret0",
Expand All @@ -118,19 +94,19 @@
},
"$this->…": {
"prefix": "this",
"body": "$this->$0"
"body": "\\$this->$0"
},
"echo $this->…": {
"prefix": "ethis",
"body": "echo $this->$0"
"body": "echo \\$this->$1;\n$0"
},
"Throw Exception": {
"prefix": "throw",
"body": "throw new $1Exception(${2:\"${3:Error Processing Request}\"}${4:, ${5:1}});\n$0"
},
"while …": {
"prefix": "while",
"body": "while (${1:$a <= 10}) {\n\t${0:# code...}\n}"
"body": "while (${1:$$a <= 10}) {\n\t${0:# code...}\n}"
}
}
}

0 comments on commit be091ab

Please sign in to comment.