当前位置:网站首页>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 :

边栏推荐
- How do we do full link grayscale on the database?
- Goweb开发之Beego框架实战:第五节 项目搭建及注册用户
- The actual combat of the beego framework of goweb development: Section III program execution process analysis
- 数据库优化——深入理解Mysql索引底层数据结构与算法
- JS中为对象数组添加新对象结果导致数组中已存在的对象也修改了
- Goweb开发之Iris框架实战:项目总结与回顾
- Iris framework practice of goweb development: project summary and review
- 技术面轻松通过,HR:只有三年大厂经验的不值20K
- [Presto] common commands of Presto
- 【CDH】通过 ClouderaManager 配置CDH组件用 prometheus 监控采集JMX信息
猜你喜欢

Vscode uses eslint prettier to format code automatically

Net framework

The actual combat of the beego framework of goweb development: Section III program execution process analysis

Verilog daily question (vl4 shift operation and multiplication)

Encrypt the video and upload it to OSS to achieve high concurrent access

Verilog daily question (vl5 signal generator)

MySQL detailed learning tutorial (recommended Collection)

AMQP protocol details

wpf命令按钮透明样式

数据库优化——深入理解Mysql索引底层数据结构与算法
随机推荐
【kibana】问题整理 kibana 7.x No indices match pattern “apm-*“
2021 年全国大学生数据统计与分析竞赛
Role of Fortress machine
MySQL详细学习教程(建议收藏)
Editor MAVON editor for offline use
Selection and application of inductors in high speed circuits
Firewalld防护墙
Batch download files
[kibana] problem sorting kibana 7.x no indices match pattern "APM-*“
Connection design and test platform -- Summary of SystemVerilog interface knowledge points
Verilog daily question (vl5 signal generator)
MySQL implements sorting according to custom (specified order)
Encrypt the video and upload it to OSS to achieve high concurrent access
部分情况下Error:(xx, xx) Failed to resolve: xxxxxx解决。
Verilog 每日一题 (VL5 信号发生器)
Linear algebra and matrix theory (VIII)
Redis源码剖析,狠狠地拿捏了,赶紧码住
【impala】【报错解决】 Impala cannot read or execute the parent directory of dfs.domain.socket.path的解决方法
Use Alibaba cloud's free SSL certificate
Visual Studio 2015 团队开发之Azure DevOps篇