1. Search for koroFileHeader in the Vscode extension store and click to install
2. Comment on the template settings
Search for fileheader in the user preferences. The default configuration is:
"fileheader.customMade": {} // 头部注释 "fileheader.cursorMode": {} // 函数注释
Custom template:
In user settings, search for fileheader, copy the default configuration, modify the configuration, and restart to take effect
The modified comments are as follows:
// 文件头部注释 /* * @Description: * @version: * @Company: BAT * @Author: OBKoro1 * @Date: 2018-10-15 20:59:57 * @LastEditors: OBKoro1 * @LastEditTime: 2018-10-15 20:59:57
*/ // 函数注释 /** * @name: * @test: test font * @msg: * @param {type} * @return: */
3. Use the
file header comment:
Use the shortcut keys in the currently edited file: window: ctrl alt t/mac: ctrl cmd t to generate the file Header annotation.
Function comments:
Place the cursor on the function line or place the cursor on the blank line above the function, and use the shortcut keys window: ctrl alt t, mac: ctrl cmd t to generate Function comments.
In fact, function comments can be generated anywhere in the file, and you need to control them here.
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of How to add comments in vscode. For more information, please follow other related articles on the PHP Chinese website!