0.插件
- C/C++
- C++ Intellisense
- Doxygen Documentation Generator
- Msg Language Support
- XML Tools
- Todo Tree: 注释的高亮显示
- Chinese (Simplified)
- CMake
- CMake Tools
- Comment Translate
- Draw.io Integration (画流程图)
- Drawio Preview
- indent-rainbow(显示空格)
- LeetCode
- PlantUML(画类图)
- ROS
eigen 代码显示红线:
首先,按下快捷键Ctrl + Shift + P
,输入edit configuration
,选择C/Cpp: Edit Configurations(JSON)
,此时会在工程的配置目录.vscode
下生成一个配置文件:c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**",
"/usr/local/include/**",
"/opt/ros/melodic/include",
"/usr/include/eigen3" //添加库路径
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
基本上:
"/usr/include/**",
"/usr/local/include/**",
"/opt/ros/melodic/include",
"/usr/include/eigen3" 链接了大部分库吧
1.seetings.json
{
"doxdocgen.generic.paramTemplate": "@param[in] {param} ",
// 在注释中搜索以 * // , # , ; , 开头的标签! -- 或 / *
"todo-tree.regex.regex": "((\\*|//|#|<!--|;|/\\*|^)\\s*($TAGS)|^\\s*- \\[ \\])",
"todo-tree.highlights.defaultHighlight": {
"icon": "alert",
"type": "text",
"foreground": "red",
"iconColour": "green"
},
"todo-tree.general.tags": [
"?",
"!",
"param",
"step",
"Step",
"c++11",
"note",
"tag",
"todo",
],
"todo-tree.highlights.customHighlight": {
"?": {
"icon": "question",
"foreground": "#CCFF33",
"iconColour": "#CCFF33",
"type": "text-and-comment"
},
"!": {
"foreground": "red",
"icon": "issue-opened",
"iconColour": "red",
"type": "text-and-comment"
},
"step": {
"foreground": "#7CFC00",
"icon": "question",
"iconColour": "green",
"type": "text-and-comment",
"hideFromTree": true
},
"Step": {
"foreground": "#7CFC00",
"icon": "question",
"iconColour": "green",
"type": "text-and-comment",
"hideFromTree": true
},
"c++11": {
"icon": "tag",
"foreground": "violet",
"rulerColour": "violet",
"iconColour": "violet",
"type": "text-and-comment",
},
"note": {
"icon": "note",
"foreground": "#00BFFF",
"rulerColour": "#00BFFF",
"iconColour": "#00BFFF",
"type": "text-and-comment",
},
"param": {
"icon": "issue-closed",
"foreground": "#48D1CC",
"rulerColour": "#48D1CC",
"iconColour": "#48D1CC",
"type": "text-and-comment",
},
"tag": {
"icon": "tag",
"foreground": "#00FF7F",
"rulerColour": "#00FF7F",
"iconColour": "#00FF7F",
"rulerLane": "full",
"type": "text-and-comment",
},
"todo": {
"foreground": "#f90",
"rulerColour": "#f90",
"iconColour": "#f90",
"type": "text-and-comment",
},
},
"python.autoComplete.extraPaths": [
"/opt/ros/melodic/lib/python2.7/dist-packages"
],
"todo-tree.tree.showBadges": false,
"todo-tree.general.revealBehaviour": "highlight todo",
"todo-tree.tree.showCountsInTree": true,
"todo-tree.filtering.excludeGlobs":[
"**/*.txt",
"**/*.md"
],
"files.associations": {
"*.cc": "cpp",
"vector": "cpp",
"mutex": "cpp",
"list": "cpp",
"xtree": "cpp",
"map": "cpp",
"algorithm": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"memory": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"queue": "cpp",
"ratio": "cpp",
"set": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocinfo": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xutility": "cpp"
},
"commentTranslate.source": "Google",
"commentTranslate.targetLanguage": "zh-CN",
"powermode.enabled": true,
"markdown-preview-enhanced.previewTheme": "one-dark.css",
"markdown-preview-enhanced.breakOnSingleNewLine": false,
"markdown-preview-enhanced.codeBlockTheme": "one-dark.css",
"markdown-preview-enhanced.pandocArguments": [
{
"output":{
"pdf_document":{
"toc": true,
"toc_depth": 4,
"number_sections": true,
"highlight": "tango"
}
}
}
],
"debug.onTaskErrors": "debugAnyway",
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"typescript.disableAutomaticTypeAcquisition": true,
"C_Cpp.errorSquiggles": "Enabled",
"clang.cxxflags": [
"-std=c++11"
],
"C_Cpp.updateChannel": "Insiders",
"files.autoSave": "afterDelay",
"fileheader.Author": "bFeng",
"fileheader.LastModifiedBy": "bFeng",
"fileheader.tpl": "// Create by {author}. {createTime}",
"fileheader.customMade": {
"Date": "Do not edit",
"Author": "bFeng",
},
"editor.detectIndentation": false,
"leetcode.endpoint": "leetcode-cn",
"leetcode.workspaceFolder": "/home/q/.leetcode",
"C_Cpp.clang_format_fallbackStyle": "Google",
"editor.tabSize": 2,
"powermode.shake.intensity": 0,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"[c]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"todo-tree.general.tagGroups": {
}
}
2.tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "catkin_make",
"type": "shell",
"command": "catkin_make_isolated --install --use-ninja", // catkin_make
"args": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
},
]
}
3.launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch test_code", // 配置名称, 将会在调试配置下拉列表中显示
"type": "cppdbg", // 调试器类型 该值自动生成
"request": "launch", // 调试方式,还可以选择attach
"program": "${workspaceRoot}/devel/lib/beginner_tutorials/test_node", //要调试的程序(完整路径, 支持相对路径)
"args": [], // 传递给上面程序的参数, 没有参数留空即可
"stopAtEntry": false, // 是否停在程序入口点(停在main函数开始)
"cwd": "${workspaceFolder}", // 调试程序时的工作目录
"environment": [], // 针对调试的程序, 要添加到环境中的环境变量. 例如: [ { "name": "squid", "value": "clam" } ]
"externalConsole": false, // 如果设置为true, 则为应用程序启动外部控制台. 如果为false, 则不会启动控制台, 并使用VS Code的内置调试控制台.
"MIMode": "gdb", // VSCode要使用的调试工具
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
4.c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build_isolated/cartographer/install/compile_commands.json"
}
],
"version": 4
}