Open xgqfrms opened 1 year ago
vscode code snippets
https://code.visualstudio.com/docs/editor/userdefinedsnippets
.vscode/.code-snippets/
https://code.visualstudio.com/api/language-extensions/snippet-guide
{
"contributes": {
"snippets": [
{
"language": "javascript",
"path": "./snippets.json"
}
]
}
}
https://www.freecodecamp.org/news/definitive-guide-to-snippets-visual-studio-code/
https://stackoverflow.com/questions/44321000/visual-studio-code-user-snippets-not-working
{
"PHP 8 Template": {
"scope": "php, html",
"prefix": "p8t",
"body": [
"<?php",
"",
"/**",
" * ",
" * @author xgqfrms",
" * @license MIT",
" * @copyright xgqfrms",
" * @created 2022-12-1$1",
" * @modified ",
" * ",
" * @description $2",
" * @link http://www.webhacker.com/$3.php",
" * ",
" */",
"",
"$args = $_GET[\"args\"];",
"// $params = $_POST[\"params\"];",
"// $all_in_one = $_REQUEST[\"args\"];",
"echo \"<h1 style=\"color: red;\">red color: $args</h1>\";",
"/*",
"",
"",
"*/",
"",
"?>"
],
"description": "PHP 8 Template & code snippets!"
}
}
vscode php code snippets not work
https://github.com/microsoft/vscode/issues/113476
https://github.com/microsoft/vscode/issues/75955
https://stackoverflow.com/questions/44321000/visual-studio-code-user-snippets-not-working
~/Library/Application Support/Code/User/snippets/php.code-snippets
.code-snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
}
{
"PHP 8 Template": {
"prefix": "p8t",
"body": [
"<?php",
"",
"/**",
" * ",
" * @author xgqfrms",
" * @license MIT",
" * @copyright xgqfrms",
" * @created 2022-12-1$1",
" * @modified ",
" * ",
" * @description $2",
" * @link http://www.webhacker.com/$3.php",
" * ",
" */",
"",
"$args = $_GET[\"args\"];",
"// $params = $_POST[\"params\"];",
"// $all_in_one = $_REQUEST[\"args\"];",
"echo \"<h1 style=\"color: red;\">red color: $args</h1>\";",
"/*",
"",
"",
"*/",
"",
"?>"
],
"description": "PHP 8 Template & code snippets!"
}
}
PHP & code snippets
https://github.com/xgqfrms/vscode/blob/master/code-snippets/php.json