May 31, 2020
In the Tutorial we will create personal snippets that will help us to program quickly without worrying about syntax or details.
More than one person opens a downloaded VS Code Snippet extension, but why not create the ones that are most used by one?
It's very simple and we must do the following:
1) In VS Code's top menu choose File, then Preferences and finally choose User Snippets
2) In the middle of VS Code a list of options will be displayed, for the Tutorial we will select php.json
3) It will open the code fragment file php.json, as you will see there is an explanation and example that is commented in addition to some snippets that I have created.
4) The structure is very simple:
I explain line by line below:
4) For example the prefix is todoPHP, we write 'all' and a box will appear that shows the complete prefix of allPHP and you can see part of 'description'.
5) The structure that was written inside body will appear, notice that the cursor that is the vertical red line is to the right of the # symbol and in the $1 location:
Maybe the example seen is very simple, now you will see one that I use as a header of my PHP files to start writing documentation, it has 15 variables ($1...$15) and the goal is to document the logic of the file:
Well, I hope the Tutorial served you well. What snippet would you create?