vscode snippets
satya - 2/11/2024, 3:28:50 PM
Stupid thing!!!
satya - 2/11/2024, 3:29:59 PM
The file will be saved under
your folder/.vscode/file.code-snippets
satya - 2/11/2024, 3:30:12 PM
An example
{
"Block Comments": {
"scope": "python",
"prefix": "block_comments",
"body": [
"\"\"\"",
"*************************************************",
"* Prep the template",
"*************************************************",
"\"\"\""
],
"description": "Inserts a block comment for template preparation."
}
}
satya - 2/11/2024, 3:31:24 PM
Note the global files are stored under
/users/user/appdata/roaming/code/user/snippets/filenam.code-snippets
satya - 2/11/2024, 3:41:48 PM
Here is how you put 2 snippets
{
"Block Comments": {
"scope": "python",
"prefix": "block_comments",
"body": [
"\"\"\"",
"*************************************************",
"* Prep the template",
"*************************************************",
"\"\"\""
],
"description": "Inserts a block comment for template preparation."
},
"lib_main_snippet": {
"prefix": "lib_main_snippet",
"body": [
"def test():",
" pass",
"",
"def localTest():",
" log.ph1(\"Starting local test\")",
" test()",
" log.ph1(\"End local test\")",
"",
"if __name__ == '__main__':",
" localTest()"
],
"description": "Template for local testing with a main block"
}
}
satya - 2/11/2024, 3:43:46 PM
The json format of this file is important
satya - 2/11/2024, 3:46:39 PM
How to create this snippet file
satya - 2/11/2024, 3:47:41 PM
How do I invoke or insert the snippet
satya - 2/11/2024, 3:49:10 PM
You have the option in settings to