Skip to content

Instantly share code, notes, and snippets.

@BrainBear
Last active July 9, 2025 08:41
Show Gist options
  • Save BrainBear/0605fd8f4f28e604650617bd11a1d1aa to your computer and use it in GitHub Desktop.
Save BrainBear/0605fd8f4f28e604650617bd11a1d1aa to your computer and use it in GitHub Desktop.
custom postfix completion settings
{
"custom-postfix-completion": {
"languageTemplates": {
"dart": {
"templates": [
{
"triggerWord": "if",
"description": "If condition",
"targetRegExp": "\\w+",
"body": ["if(${target}) {\n ${CODE#0}\n}"]
},
{
"triggerWord": "ifnot",
"description": "If not condition",
"targetRegExp": "\\w+",
"body": ["if(!${target}) {\n ${CODE#0} }"]
},
{
"triggerWord": "null",
"description": "If null condition",
"targetRegExp": "\\w+",
"body": ["if(${target} == null) {\n ${CODE#0} }"]
},
{
"triggerWord": "notnull",
"description": "If not null condition",
"targetRegExp": "\\w+",
"body": ["if(${target} != null) {\n ${CODE#0} }"]
},
{
"triggerWord": "for",
"description": "For loop with index",
"targetRegExp": "\\w+",
"body": ["for (var i = 0; i < ${target}${END#1}; i++) {\n ${CODE#0} }"]
},
{
"triggerWord": "forin",
"description": "For in loop",
"targetRegExp": "\\w+",
"body": ["for (var item in ${target}) {\n ${CODE#0} }"]
},
{
"triggerWord": "foreach",
"description": "ForEach method",
"targetRegExp": "\\w+",
"body": ["${target}.forEach((item) {\n ${CODE#0} });"]
},
{
"triggerWord": "var",
"description": "Variable declaration",
"targetRegExp": "\\w+",
"body": ["var ${name#1} = ${target};\n${END#0}"]
},
{
"triggerWord": "const",
"description": "Const declaration",
"targetRegExp": "\\w+",
"body": ["const ${name#1} = ${target};\n${END#0}"]
},
{
"triggerWord": "logd",
"description": "log debug",
"targetRegExp": "\"[^\"]*\"",
"body": ["L.debug(\"bear\", ${target});\n${END#0}"]
},
{
"triggerWord": "logi",
"description": "log info",
"targetRegExp": "\"[^\"]*\"",
"body": ["L.info(\"bear\", ${target});\n${END#0}"]
},
{
"triggerWord": "loge",
"description": "log error",
"targetRegExp": "\"[^\"]*\"",
"body": ["L.error(\"bear\", ${target});\n${END#0}"]
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment