1.插件设置
1.vscode-icons设置
步骤:文件->首选项->文件图标主题->vscode-icons
2.c_cpp_properties.json设置
插件:C/C++
- 生成c_cpp_properties.json文件
步骤:ctrl+shift+P
打开Command Palette,运行C/Cpp: Edit configurations...
生成c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc", //编译器路径
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
3. better Comments
4.codeif
5.tabnine
6.indent-rainbow
7.code spell checker
8.code runner
9.parameter hints
10.trailing spaces
2.快捷键
- 回跳:Ctrl + Alt + -
- 缩进:Ctrl + [ or Ctrl + ]
- 批量重命名:Ctrl +Shift + L
- 上传配置:Shift + Alt + U
- 下载配置:Shift + Alt + D
3.配置
1.VSCode 自动生成头文件的#ifndef #define #endif
参考:VSCode 自动生成头文件的#ifndef #define #endif
步骤:ctrl+shift+P
打开Command Palette,输入snippets
,选择
用户代码片段(configure user snippets
),选择全局代码片段(new global snippets file
),起个名字(c_cpp_header),配置文件。
"C C++ Header": {
"scope": "c, cpp",
"prefix": "header",
"description": "Add #ifndef, #define and #endif",
"body": [
"#ifndef ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}",
"#define ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}",
"",
"$0",
"",
"#endif"
]
}
2.标签栏显示效果设置
选中了红框中的文件,但是显示效果不突出。
修改workbench.editor.decorations.colors,去掉勾勾
3.vscode空格间距太小
- 修改设置中的editor.font family :monospace
- 修改后的效果:
4.实现声明和定义跳转
-
创建c_cpp_properties.json文件
ctrl+shift+P
打开Command Palette,运行C/Cpp: Edit configurations...
生成c_cpp_properties.json -
添加文件路径
-
重启vscode并编译
5.vscode setting-sync设置
参考:[参考1]https://www.cnblogs.com/lychee/p/11214032.htmlhttps://www.cnblogs.com/lychee/p/11214032.html
6.vscode代码提示
设置中取消掉勾选项: