Doxygen与Vscode操作全解

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Doxygen与Vscode操作全解相关的知识,希望对你有一定的参考价值。


0. 简介

在提升算法认识的同时,本人逐渐认识到有一个好的开发文档/UML图是多么方便,而很多时候代码的开发维护总是会缺少这样的工作。这里以Doxygen为主,介绍本人在Ubuntu环境下的开发操作。

1. Doxygen安装

Ubuntu/Debian安装

sudo apt-get install doxygen

生成配置文件

doxygen -g

该命令会在当前路径生成一个名为Doxyfile配置文件。这里可以考虑使用第三点的文件直接输出一个合适的Doxygen文档。

2. Doxygen设置vscode配置文件

  • 选择安装扩展:左下角齿轮,扩展,搜索“doxdocgen
  • 安装后,左侧插件上点邮件,菜单中选**“扩展设置”**
  • 点击“在setting.json编辑”,直接打开setting.json文件,贴上下述代码。

"editor.tabSize": 2,
"editor.rulers": [
100
],
"editor.fontSize": 16,
"emmet.excludeLanguages": [
"markdown"
],
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": true,
// // 重新设定tabsize
"editor.tabSize": 2,
// #每次保存的时候自动格式化
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
// "editor.defaultFormatter": "xaver.clang-format",
"C_Cpp.clang_format_fallbackStyle": " BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4,",
"C_Cpp.clang_format_style": " BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, ",
"[cpp]":
"editor.defaultFormatter": "ms-vscode.cpptools"
,
"C_Cpp.formatting": "Default",
"C_Cpp.vcFormat.indent.accessSpecifiers": true,
"clang-format.fallbackStyle": "Google",

"files.associations":
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml",
"chrono": "cpp",
"*.ipp": "cpp",
"*.h": "cpp",
"bitset": "cpp",
"memory": "cpp",
"random": "cpp",
"future": "cpp",
"optional": "cpp",
"ostream": "cpp",
"iostream": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"core": "cpp",
"queue": "cpp",
"unordered_set": "cpp",
"dense": "cpp",
"numericaldiff": "cpp",
"*.idl": "cpp",
"any": "cpp",
"hash_map": "cpp",
"hash_set": "cpp",
"ceres.h": "c",
"se3.hpp": "c",
"rotation.h": "c"
,
// Autocomplete from ros python packages
"python.autoComplete.extraPaths": [
"/opt/ros/foxy/lib/python3.8/site-packages/"
],
// Environment file lets vscode find python files within workspace
"python.envFile": "$workspaceFolder/.env",
// Use the system installed version of autopep8
"python.formatting.autopep8Path": "/usr/bin/autopep8",
"python.formatting.autopep8Args": [
"--max-line-length=100"
],
"C_Cpp.default.intelliSenseMode": "clang-x64",
"C_Cpp.formatting": "Disabled",
"uncrustify.useReplaceOption": true,
"uncrustify.configPath.linux": "/opt/ros/foxy/lib/python3.8/site-packages/ament_uncrustify/configuration/ament_code_style.cfg",
"cSpell.words": [
"athackst",
"autopep",
"cmake",
"cppcheck",
"cpplint",
"deque",
"devcontainer",
"ints",
"noqa",
"odometry",
"pytest",
"rclcpp",
"rclpy",
"repos",
"rosdistro",
"rosidl",
"RTPS",
"uncrustify",
"xmllint"
],
"search.exclude":
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/build": true,
"**/install": true,
"**/log": true
,
"python.analysis.extraPaths": [
"/opt/ros/foxy/lib/python3.8/site-packages/"
],
"cSpell.allowCompoundWords": true,
"cSpell.ignorePaths": [
"**/package-lock.json",
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/objects/**",
".vscode",
".vscode-insiders",
".devcontainer/devcontainer.json"
],
"ros.distro": "foxy",
"C_Cpp.errorSquiggles": "Disabled",

// Doxygen documentation generator set
// 文件注释:版权信息模板
"doxdocgen.file.copyrightTag": [
"@copyright Copyright (c) year TEST"
],
// 文件注释:自定义模块,这里我添加一个修改日志
"doxdocgen.file.customTag": [
"@par 修改日志:",
"<table>",
"<tr><th>Date <th>Version <th>Author <th>Description",
"<tr><td>date <td>2.0 <td>test <td>内容",
"</table>",
],
// 文件注释的组成及其排序
"doxdocgen.file.fileOrder": [
"file", // @file
"brief", // @brief 简介
"author", // 作者
"version", // 版本
"date", // 日期
"empty", // 空行
"copyright",// 版权
"empty",
"custom" // 自定义
],
// 下面时设置上面标签tag的具体信息
"doxdocgen.file.fileTemplate": "@file name",
"doxdocgen.file.versionTag": "@version 2.0",
"doxdocgen.generic.authorEmail": "test@test.com",
"doxdocgen.generic.authorName": "test",
"doxdocgen.generic.authorTag": "@author author (email)",
// 日期格式与模板
"doxdocgen.generic.dateFormat": "YYYY-MM-DD",
"doxdocgen.generic.dateTemplate": "@date date",
// 根据自动生成的注释模板(目前主要体现在函数注释上)
"doxdocgen.generic.order": [
"brief",
"tparam",
"param",
"return"
],
"doxdocgen.generic.paramTemplate": "@paramindent:8paramindent:25My Param doc",
"doxdocgen.generic.returnTemplate": "@return type ",
"doxdocgen.generic.splitCasingSmartText": true,
"cmake.sourceDirectory": "$workspaceFolder/src/test",

3. Doxygen设置Doxyfile

…详情请参照​​古月居​


以上是关于Doxygen与Vscode操作全解的主要内容,如果未能解决你的问题,请参考以下文章

在QtCreator中使用doxygen

doxygen+graphviz轻松绘制函数调用图(call graph)

doxygen+graphviz轻松绘制函数调用图(call graph)

一个demo学会js

如何用vscode远程连接利用腾讯云服务器搭建的linux操作环境?

如何用vscode远程连接利用腾讯云服务器搭建的linux操作环境?