Table of contents
When using vscode, you must pay attention: Don’t have a Chinese path, don’t have a Chinese path, don’t have a Chinese path ! ! !
1. Automated annotation tools
Configuration of the koroFileHeader
header template, a relatively good annotation tool I have used : link
Default shortcut keys after installation
- File header comments: window :
ctrl+alt+i
, mac :ctrl+cmd+i
- Function comments: window :
ctrl+alt+t
, mac :ctrl+cmd+t
2. Code formatting and error checking
It is recommended to use flake8
and yapf
for error checking and code formatting respectively.
Reference link: VS Code | Configure flake8 and yapf
Be sure to note here that when using formatting:
- First of all, make sure there are no errors, otherwise the automatic formatting is very likely to fail. Note that it is not that yapf will not work at this time. Just debug the syntax errors.
- Don’t have a Chinese path, don’t have a Chinese path, don’t have a Chinese path ! ! !
//"python.linting.enabled": true,//用于激活自定义的代码错误提示功能
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Args": [
"--max-line-length=1248"
], // 设置单行最长字符限制
"python.linting.pylintEnabled": false,
"python.formatting.provider": "yapf", // 关闭pylint工具
"editor.formatOnType": true, //这两句实现保存时自动格式化
"editor.formatOnSave": true
3. About sometimes not being able to view code definitions
This problem is equivalent to vscode being unable to find the location of the code file and not being able to automatically prompt when writing code.
Click Settings > Command Panel > Enter Reload Window
Just reload the window
4. Encoding format settings
{
Language: Cpp, BasedOnStyle: Google, ColumnLimit: 120, DerivePointerAlignment: true, PointerAlignment: Left, SortIncludes: true, IncludeBlocks: Preserve, IndentPPDirectives: AfterHash, ForEachMacros: ['']}