VSCode Snippets: Difference between revisions
(→PHP) |
|||
| (7 intermediate revisions by the same user not shown) | |||
| Line 139: | Line 139: | ||
"description": "Heading for new PHP File" | "description": "Heading for new PHP File" | ||
} | } | ||
} | |||
</pre> | |||
== YAML == | |||
=== OAT Documentation === | |||
Write template and Ctrl(⌃) + SPACE and ENTER. | |||
<pre> | |||
{ | |||
"YAML Template": { | |||
"prefix": "template", | |||
"body": [ | |||
"description: ${1:woYYYY-## | project_name | sprint | description}", | |||
"tasks:", | |||
" - ${2:task_number_in_devOps}: ${3:description} # If no task number available use N/A", | |||
"status: ${4:pending | date_applied (YYYY_MM_DD)}", | |||
"", | |||
"database: ${5:TPI | TA | TS}", | |||
"databases_applied:", | |||
" ${6:database_name}: ${7:pending | date_applied (YYYY_MM_DD)}", | |||
"", | |||
"changes:", | |||
" tables:", | |||
" add:", | |||
" - ${8:table_name}", | |||
" change:", | |||
" - ${9:old_table_name -> new_table_name}", | |||
" delete:", | |||
" - ${10:table_name}", | |||
" columns:", | |||
" add:", | |||
" ${11:table_name}:", | |||
" - ${12:new_column_name}", | |||
" change:", | |||
" ${13:table_name}:", | |||
" - ${14:old_column_name -> new_column_name}", | |||
" delete:", | |||
" ${15:table_name}:", | |||
" - ${16:column_name}", | |||
" rows:", | |||
" add:", | |||
" ${17:table_name}:", | |||
" - ${18:description}", | |||
" change:", | |||
" ${19:table_name}:", | |||
" - ${20:old_value -> new_value}", | |||
" delete:", | |||
" ${21:table_name}:", | |||
" - ${22:description}", | |||
"", | |||
"notes: ${23:# Optional: Developer comments}" | |||
], | |||
"description": "Insert YAML template for project tasks, statuses, changes, and notes." | |||
} | |||
} | } | ||
</pre> | </pre> | ||
Latest revision as of 19:36, 7 April 2025
Javascript
Class Author
{
"classAuthorJS": {
"scope": "javascript,typescript",
"prefix": "class",
"body": [
"/**",
"* $TM_FILENAME_BASE.js",
"* @author [FirstName LastName] <firstName.lastName@seedburysquare.com>",
"* @copyright Seedbury Square, LLC. All Rights Reserved.",
"*",
"* @version $CURRENT_YEAR-$CURRENT_MONTH_NAME-$CURRENT_DATE Initial Version",
"*/",
"",
"export class $TM_FILENAME_BASE{",
"constructor(){",
"this.view = setElementClassList(getElementContainer(), '${TM_FILENAME_BASE/^(.)(.*)/${1:/downcase}${2}/}__view');",
"$1",
"}",
"}"
],
"description": "Heading for new JS File"
}
}
Console Log
(Cristian Lopez y Eduardo Valladares delete before pushing code)
{
"console.log()": {
"scope": "javascript,typescript, jsx, tsx",
"prefix": "cl",
"body": [
"console.log($1);"
],
"description": "console.log();"
}
}
CSS
{
"css": {
"scope": "javascript,typescript",
"prefix": "css",
"body": [
"'${TM_FILENAME_BASE/^(.)(.*)/${1:/downcase}${2}/}__$1'"
],
"description": "consoles class file name"
}
}
Error Handling
{
"error": {
"scope": "javascript,typescript",
"prefix": "catch",
"body": [
".catch((err) => {",
"console.error(err);",
"});"
],
"description": "catch services error"
}
}
CSS
Class Author
{
"classAuthorCSS": {
"scope": "css",
"prefix": "class",
"body": [
"/**",
"* $TM_FILENAME_BASE.css",
"* @author John A Cruz Merced <john.cruz@seedburysquare.com>",
"* @copyright Seedbury Square, LLC. All Rights Reserved.",
"*",
"* @version $CURRENT_YEAR-$CURRENT_MONTH_NAME-$CURRENT_DATE Initial Version",
"*/",
"",
".${TM_FILENAME_BASE}__view{",
"$1",
"}"
],
"description": "Heading for new css File"
}
}
PHP
File author
validateParams function should be imported (the path will depend by project).
{
"classAuthorPHP": {
"scope": "php",
"prefix": "service",
"body": [
"/**",
"* $TM_FILENAME_BASE.php",
"* @author Raúl E. Barroso Suárez <raul.barrroso@seedburysquare.com>",
"* @copyright Seedbury Square, LLC. All Rights Reserved.",
"*",
"* @version $CURRENT_YEAR-$CURRENT_MONTH_NAME-$CURRENT_DATE Initial Version",
"*/",
"",
"return Closure::fromCallable('$TM_FILENAME_BASE');",
"function $TM_FILENAME_BASE($$params, $$dbDriver = null)",
"{",
" try {",
" $$validation = validateParams($$params, [$1], '$TM_FILENAME_BASE');",
" if (!$$validation['success']) return $$validation;",
" $$dbDriver = $$dbDriver ?? new DatabaseDriver($2);",
" $$response = $$dbDriver->${3:select}('$4', [$5]);",
" return uniformReturnObject(",
" $$response['success'],",
" $$response['success'] ? $$response['result'] : null,",
" $$response['success'] ? null : $$response['errorMsg'],",
" $$response['success'] ? null : $$response['errorMsg']",
" );",
" } catch (\\Throwable $$e) {",
" error_log($$e);",
" return uniformReturnObject(false, null, $$e->__toString(), $$e->__toString());",
" }",
"};"
],
"description": "Heading for new PHP File"
}
}
YAML
OAT Documentation
Write template and Ctrl(⌃) + SPACE and ENTER.
{
"YAML Template": {
"prefix": "template",
"body": [
"description: ${1:woYYYY-## | project_name | sprint | description}",
"tasks:",
" - ${2:task_number_in_devOps}: ${3:description} # If no task number available use N/A",
"status: ${4:pending | date_applied (YYYY_MM_DD)}",
"",
"database: ${5:TPI | TA | TS}",
"databases_applied:",
" ${6:database_name}: ${7:pending | date_applied (YYYY_MM_DD)}",
"",
"changes:",
" tables:",
" add:",
" - ${8:table_name}",
" change:",
" - ${9:old_table_name -> new_table_name}",
" delete:",
" - ${10:table_name}",
" columns:",
" add:",
" ${11:table_name}:",
" - ${12:new_column_name}",
" change:",
" ${13:table_name}:",
" - ${14:old_column_name -> new_column_name}",
" delete:",
" ${15:table_name}:",
" - ${16:column_name}",
" rows:",
" add:",
" ${17:table_name}:",
" - ${18:description}",
" change:",
" ${19:table_name}:",
" - ${20:old_value -> new_value}",
" delete:",
" ${21:table_name}:",
" - ${22:description}",
"",
"notes: ${23:# Optional: Developer comments}"
],
"description": "Insert YAML template for project tasks, statuses, changes, and notes."
}
}