I recently started learning with PyGame and I'm getting tired of writing the basic skeleton over and over again. Is there any way to make Visual Studio Code autoload the skeleton for me?
For example in HTML, when you write an exclamation mark (!) and then press the tab key, it autoloads the basic HTML skeleton.
Would be OK for me, if there was any built-in way to do this. But it would be even better, if I could define the skeleton by myself (because I like to put comments there and I'm used to a particular order of the skeleton) and then connect it to some shorcut or something.
CodePudding user response:
Code snippets may be useful to you.
Code snippets are templates that make it easier to enter repeating code patterns, such as loops or conditional-statements.
Choose python
in the list
At this time, vscode will automatically create a file named python.json
. There you can customize code snippets.
A small example
code in ``python.json`
"Print to console": {
"prefix": "defHello",
"body": [
"def Hello():",
"${1: }print('Hello world')",
"$2",
],
"description": "print hello world"
}
When you type def...
, there will be a corresponding intellisense
Enter to select, automatically insert the statement you configured.