当前位置:网站首页>Vscode plug-in automatically adds comments
Vscode plug-in automatically adds comments
2022-07-28 17:32:00 【Joshua02】
1、 install koroFileHeader plug-in unit
2、 To configure
1) ctrl+shelf+p Input Open Workspace Settings ( Open workspace settings )

2) Search for fileheader

3) edit setting.json file ( All three edit the same file )
Then replace and save the following code
{
// Head note
"fileheader.customMade": {
// Header comment default field
"Author": "your name",
"Date": "Do not edit", // After setting, the default setting is file generation time
"LastEditTime": "Do not edit", // After setting , Save the file, change the default update, last edit time
"LastEditors": "your name", // After setting , Save the file, change the default and update the last editor
"Description": "",
"FilePath": "Do not edit", // After setting , The path of the default build file relative to the project
"custom_string_obkoro1": " You can enter a predetermined copyright notice 、 Individuality signature 、 Empty line, etc "
},
// Function Comments
"fileheader.cursorMode": {
// Default fields
"description":"",
"param":"",
"return":""
},
// Plug in configuration items
"fileheader.configObj": {
"autoAdd": false, // The detection file has no header comments , Automatically add file header comments
"autoAddLine": 100, // How many lines does the file exceed No more automatic header comments
"autoAlready": true, // Only add the languages supported by the plug-in and the user through `language` Option custom comments
"supportAutoLanguage": [], // After setting , Only files in the array can be added automatically
// Automatically add header comment blacklist
"prohibitAutoAdd": [
"json"
],
"prohibitItemAutoAdd": [ " The full name of the project. It is forbidden to automatically add header comments to the project , Use the shortcut keys to add your own " ],
"folderBlacklist": [ "node_modules" ], // Automatic header comments are not allowed for folder or file names
"wideSame": false, // Header annotation equal width setting
"wideNum": 13, // Header comment field length The default is 13
"functionWideNum": 0, // Function annotation equal width setting Set to 0 It is closed
// Insert... In the first few lines of the header comment
"headInsertLine": {
"php": 2 // php file Insert into the second line
},
"beforeAnnotation": {}, // Insert before the header comment
"afterAnnotation": {}, // Insert content after header comment
"specialOptions": {}, // Special field customization
"switch": {
"newlineAddAnnotation": true // By default, line breaks are encountered (\r\n \n \r) Add annotation symbols
},
"moveCursor": true, // Automatically move the cursor to Description Place of action
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"atSymbol": ["@", "@"], // Change... In custom comments for all files @ Symbol
"atSymbolObj": {}, // Change individual language / Of documents @
"colon": [": ", ": "], // Change the comment colon of all files
"colonObj": {}, // Change individual language / The colon of the file
"filePathColon": " Path separator replacement ", // The default value is : mac: / window yes : \
"showErrorMessage": false, // Whether to display plug-in error notification be used for debugger
"writeLog": false, // Error log generation
"CheckFileChange": false, // When a single file is saved diff Check
"createHeader": false, // Automatically add header comments to new files
"useWorker": false, // Whether to use workspace settings
"designAddHead": true, // Add a header note when adding an annotation pattern
"headDesignName": "random", // Which pattern does the pattern annotation use
/*
'random', // Random
'buddhalImg', // Sakyamuni
'buddhalImgSay', // Sakyamuni + Buddha says
'buddhalSay', // Buddha says
'totemDragon', // Dragon totem
'belle', // beauty
'coderSong', // Code Monkey
'loitumaGirl', // The girl throwing onions
'keyboardAll', // Full keyboard
'keyboardSmall', // Keypad
'totemWestDragon', // Fire breathing dragon
'jesus', // Jesus Christ
'dog', // Dog
'grassHorse', // fuck you
'grassHorse2', // fuck you 2
'totemBat', // Bat
*/
"headDesign": true, // Whether to replace head notes with pattern notes
// Whether the custom configuration generates comments within the function Different file types and language types
"cursorModeInternalAll": {}, // The default is false Generate function comments outside the function
"openFunctionParamsCheck": true, // Turn on and off automatic extraction and addition of function parameters
"functionParamsShape": ["{", "}"], // Function parameter shape customization
// "functionParamsShape": "no type" Function arguments do not require type
"functionBlankSpaceAll": {}, // Function comment space indented The default is empty object The default value is 0 Don't indent
"functionTypeSymbol": "*", // The default value when the parameter has no type
"typeParamOrder": "type param", // Parameter type and The position of the parameter is customized
// Custom language comments , Custom cancel head、end part
// Do not set custom configuration language Invalid By default head、end
"customHasHeadEnd": {}, // "cancel head and function" | "cancel head" | "cancel function"
"throttleTime": 60000, // For the same file I need to 1 Minutes to modify the file again and save it before updating the comments
// Custom language annotation symbols , Override the annotation format of the plug-in
"language": {
// js Suffix file
"js": {
"head": "/$$",
"middle": " $ @",
"end": " $/",
// Function custom annotation symbol : If you have this configuration Will be used by default
"functionSymbol": {
"head": "/******* ", // Unified increase of several * Number
"middle": " * @",
"end": " */"
},
"functionParams": "typescript" // Function annotations use ts Analytical language
},
// Match multiple file suffixes at one time Don't repeat the settings
"h/hpp/cpp": {
"head": "/*** ", // Unified increase of several * Number
"middle": " * @",
"end": " */"
},
// For documents with special requirements, such as :test.blade.php
"blade.php":{
"head": "<!--",
"middle": " * @",
"end": "-->",
}
},
// Default comment Use when no annotation symbol is matched .
"annotationStr": {
"head": "/*",
"middle": " * @",
"end": " */",
"use": false
},
},
"files.associations": {
"adc.h": "c"
}
}
Then we can use it
3、 Using shortcut keys
Notes at the top of the file Shortcut key
window:ctrl+win+i
mac:ctrl+cmd+i
linux: ctrl+meta+i
Ubuntu: ctrl+super+i
Function Comments Shortcut key
window:ctrl+win+t
mac:ctrl+cmd+t
linux: ctrl+meta+t
Ubuntu: ctrl+super+t

The function comment cursor moves to the next line , Quickly add function parameter descriptions
window: win+y
mac: cmd+y
linux: meta+y
After generating function comments , Use the shortcut keys to move the mouse to the next line , Quickly add descriptions for function parameters
In addition to using plug-ins , You can also use vscode Self contained code snippet function

choice New global code snippet
1、 Global fragment : All files are available ;
2、 Folder : The current folder is available ;
3、 Specific type : Fixed file types are available ;
Take the global fragment as an example
1、“scope”: Select the supported file type name with , Separate
2、“prefix”: Shortcut key for calling , Enter in the file and press enter to take effect
3、“body”: Corresponding display content , I won't support it Tab, Support /t Instead of
{
// 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"
// }
"add explain": {
"scope": "Vue,vue,js,javascript,typescript",
"prefix": "explain",
"body": [
"/**",
" * @description",
" * @param {*}",
" * @public",
" */ ",
],
"description": "Log output to console"
}
}Be careful :scope It only needs javascript,typescript Just go , It won't work without these two
So when you write code , When the input :explain, The editor will have code prompts , The customized code snippet will be automatically entered after entering , Pictured :

边栏推荐
- 2021 年全国大学生数据统计与分析竞赛
- LNMP source code compilation and installation
- Verilog daily question (vl14 vending machine 1 -- FSM common question types)
- Opencv based real-time stitching of simple dual camera images
- The practice of the beego framework of goweb development: Section II project initialization configuration
- 【atlas】atlas 编译报错整理(全)
- Steps to configure V530 switch
- Firewalld防护墙
- Asynchronous circuit design -- principle and example of synchronous pulser
- MySQL download update
猜你喜欢

Verilog daily question (vl24 multi bit MUX synchronizer cross time domain output)

The practice of beego framework in goweb development: Section I Introduction to beego framework

Verilog daily question (vl29 single port RAM)

Export word according to the template, generate compound format tables and variable column tables

Verilog 每日一题(VL29 单端口RAM)

How to protect image security during construction

Goweb开发之Beego框架实战:第四节 数据库配置及连接

Encountered.Sqlite file processing during Android Development

部署LAMP平台---Linux,Apache,MySQL,PHP的编译安装

Redis源码剖析,狠狠地拿捏了,赶紧码住
随机推荐
利用SQL Server代理作业对数据库进行定时还原
Use of influxdb2
SNAT、DNAT 防火墙规则的备份和还原
Vscode界面介绍
【CDH】通过 ClouderaManager 配置CDH组件用 prometheus 监控采集JMX信息
Selection and application of inductors in high speed circuits
Export word according to the template, generate compound format tables and variable column tables
Use Alibaba cloud's free SSL certificate
Verilog 每日一题(VL8 使用generate…for语句简化代码)
LNMP源码编译安装
Linear algebra and matrix theory (7)
Selection of resistance in high speed circuit
部分情况下Error:(xx, xx) Failed to resolve: xxxxxx解决。
Proof of the third scene (f) in 22 years
异步电路设计--同步脉冲器原理及例题
创建自定义分页控件
【presto】presto 常用的命令
Convert multidimensional object array to one-dimensional array
mysql实现按照自定义(指定顺序)排序
About standard IO buffers