vscode settings.json 基本配置
❯JSON
{
// workbench
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": "material-icon-theme",
"workbench.activityBar.location": "default", // 右侧活动区位置
"workbench.colorCustomizations": { // 覆盖当前选定颜色主题中的颜色
"errorLens.errorForeground": "#ff4757",
"errorLens.warningForegroundLight": "#ff6348",
"errorLens.infoBackground": "#2ed573",
"errorLens.hintBackground": "#1e90ff",
// 括号着色
"editorBracketHighlight.foreground3": "#9cdcfe",
"editorBracketHighlight.foreground4": "#f3fd00",
"editorBracketHighlight.foreground5": "#f47d9f",
"editorBracketHighlight.foreground6": "#a5adfe"
},
// editor
"editor.fontSize": 16,
"editor.fontFamily": "DroidSansMono Nerd Font, MesloLGMDZ Nerd Font",
"editor.detectIndentation": false,
"editor.guides.bracketPairs": true, // 括号指导线
"editor.stickyTabStops": true, // 使用空格缩进时模拟制表符的行为,可以方便对齐
"editor.tabSize": 4, // 一个制表符 = 4个空格
"editor.suggest.matchOnWordStartOnly": false, // 禁用建议必须匹配开头
"editor.suggest.snippetsPreventQuickSuggestions": true, // clangd的snippets有很多的跳转点,不用这个就必须手动触发Intellisense了
"editor.quickSuggestionsDelay": 0, // 控制显示快速建议前的等待时间(毫秒)
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
// 抽象符号
"*.abstract": {
"fontStyle": "italic"
},
// 只读量等效为宏
"readonly": "#4fc1ff",
// 静态量(静态变量,静态函数)
"*.static": {
"fontStyle": "bold"
},
// 宏
"macro": {
// "foreground": "#8F5DAF"
"foreground": "#4fc1ff"
},
// 成员函数
"method": {
// "foreground": "#e5b124",
"fontStyle": "underline"
},
// 命名空间
"namespace": {
"foreground": "#00d780"
},
// 函数参数
"parameter": {
"foreground": "#c8ecff"
},
// 只读的函数参数
"parameter.readonly": {
"foreground": "#7bd1ff"
},
// 成员变量,似乎需要clangd12以上
"property": {
"fontStyle": "underline",
"foreground": "#c8ecff"
},
// 类型参数
"typeParameter": "#31a567",
// 未启用的宏
"comment": "#767ba6"
}
},
// terminal
"terminal.integrated.fontSize": 15,
"terminal.integrated.fontFamily": "DroidSansMono Nerd Font, MesloLGMDZ Nerd Font",
"terminal.integrated.enableMultiLinePasteWarning": false, // 多行粘贴不提示警告
"terminal.integrated.gpuAcceleration": "on", // 集成终端使用GPU加速
// debug
"debug.console.fontSize": 15,
"debug.console.fontFamily": "DroidSansMono Nerd Font, MesloLGMDZ Nerd Font",
"debug.console.acceptSuggestionOnEnter": "on", // 调试控制台中可以用 enter 接受建议
// files
"files.autoSave": "afterDelay", // 自动保存
"files.autoSaveDelay": 5000,
// output
"output.smartScroll.enabled": true, // 输出视图智能滚动(点击锁定滚动,点击最后一行解锁)
// security
"security.workspace.trust.untrustedFiles": "open", // 不受信任文件打开不提示
// explorer
"explorer.confirmDelete": false, // 删除确认
"explorer.confirmDragAndDrop": false, // 拖拽确认
// git
"git.mergeEditor": true, // 启用三向合并编辑器
"git.confirmSync": false, // 推送不需要确认
// search
"search.showLineNumbers": true, // 显示搜索结果所在行号
// Better Comments 注释上色标签
"better-comments.highlightPlainText": true,
"better-comments.multilineComments": true,
"better-comments.tags": [
{
// 这里有问题
"tag": "BUG",
"color": "#ff4757",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 警告 之后可能出问题(比如不得已使用了粗糙的解决方法)
"tag": "HACK",
"color": "#ff6348",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "!!!", // HACK
"color": "#ff6348",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 表示代码需要修正,已经发现的问题
"tag": "FIXME",
"color": "#ffa502",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 未完成的代码
"tag": "TODO",
"color": "#eccc68",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 笔记
"tag": "NOTE",
"color": "#2ed573",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 提示
"tag": "HINT",
"color": "#1e90ff",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
// 代码注释
"tag": "//",
"color": "#474747",
"strikethrough": true,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
}
],
// TODO
"todo-tree.highlights.useColourScheme": true,
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"NOTE",
"HINT",
"[ ]",
"[x]"
],
"todo-tree.highlights.backgroundColourScheme": [
"#ff4757",
"#ff6348",
"#ffa502",
"#eccc68",
"#2ed573",
"#1e90ff",
"#fd79a8",
"#fd79a8"
],
// gitlens
"gitlens.defaultDateFormat": "YYYY-MM-DD hh:mm:ss",
"gitlens.defaultDateShortFormat": "YYYY-MM-DD",
"gitlens.graph.minimap.additionalTypes": [
"localBranches",
"stashes",
"tags",
"remoteBranches"
],
// cpp reference
"cppref.lang": "zh",
"cppref.searchEngine": "Google",
"cppref.alternative.url": "https://guyutongxue.gitee.io/cppref/zh/",
// doxdocgen
"doxdocgen.c.commentPrefix": "///",
"doxdocgen.c.firstLine": "",
"doxdocgen.c.lastLine": "",
"doxdocgen.c.triggerSequence": "///",
"doxdocgen.generic.authorName": "maxiaoxiao",
"doxdocgen.generic.authorEmail": "tttxiaoz@163.com",
"doxdocgen.file.copyrightTag": [
"@copyright Copyright (c) {year} maxiaoxiao"
],
// C/C++
"C_Cpp.intelliSenseEngine": "disabled", // 智能感知,使用clangd关闭这个
"C_Cpp.autocomplete": "disabled", // 自动补全
"C_Cpp.errorSquiggles": "disabled", // 错误检查
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.clang_format_fallbackStyle": "{Language: Cpp,BasedOnStyle: Google,AccessModifierOffset: -4,AlignConsecutiveAssignments: Consecutive,AlignConsecutiveBitFields: Consecutive,AlignConsecutiveMacros: Consecutive,BinPackArguments: false,BinPackParameters: false,ColumnLimit: 120,IndentWidth: 4,PackConstructorInitializers: Never}",
// clangd
"clangd.onConfigChanged": "restart", // 重启 clangd 时重载配置
"clangd.path": "clangd",
"clangd.arguments": [
"--all-scopes-completion", // 全局补全(补全建议会给出在当前作用域不可见的索引,插入后自动补充作用域标识符)
"--background-index", // 在后台自动分析文件(基于complie_commands)
"--clang-tidy", // 启用 Clang-Tidy 以提供「静态检查」
"--clang-tidy-checks=performance-*, bugprone-*, misc-*, google-*, modernize-*, readability-*, portability-*",
"--compile-commands-dir=build", // compelie_commands.json 文件的目录位置(相对于工作区,由于 CMake 生成的该文件默认在 build 文件夹中,故设置为 build)
"--completion-parse=auto", // 当 clangd 准备就绪时,用它来分析建议
"--completion-style=detailed", // 建议风格:打包(重载函数只会给出一个建议) bundled 相反可以设置为detailed
"--fallback-style=Google", // 默认格式化风格: 没有。clang-format时候采用
"--function-arg-placeholders=false", // 启用这项时,补全函数时,将会给参数提供占位符,键入后按 Tab 可以切换到下一占位符,乃至函数末
"--header-insertion-decorators", // 输入建议中,已包含头文件的项与还未包含头文件的项会以圆点加以区分
"--header-insertion=iwyu", // 补充头文件的形式
// "--include-cleaner-stdlib", // 为标准库头文件启用清理功能(不成熟!!!)
"--log=verbose", // 让 Clangd 生成更详细的日志
"--pch-storage=memory", // pch 优化的位置(Memory 或 Disk,前者会增加内存开销,但会提升性能)
"--pretty", // 输出的 JSON 文件更美观
"--ranking-model=decision_forest", // 建议的排序方案:hueristics (启发式), decision_forest (决策树)
// "--query-driver=C:\\Users\\11850\\scoop\\apps\\msys2\\2023-07-18\\mingw64\\bin\\g++*", // windows下的mingw位置
"--j=20" // 后台线程数
],
// [[LLDB]] --> CodeLLDB
"lldb.commandCompletions": true, // LLDB 指令自动补全
"lldb.dereferencePointers": true, // LLDB 指针显示解引用内容
"lldb.evaluateForHovers": true, // LLDB 鼠标悬停在变量上时预览变量值
"lldb.launch.expressions": "native", // LLDB 监视表达式的默认类型
"lldb.showDisassembly": "never", // LLDB 不显示汇编代码
"lldb.verboseLogging": true, // LLDB 生成更详细的日志
"lldb.suppressUpdateNotifications": true,
// cmake tools
"cmake.configureOnEdit": true,
"cmake.configureOnOpen": false, // 在 CMake 项目目录打开时自动对其进行配置
"cmake.showOptionsMovedNotification": false,
// "cmake.generator": "Unix Makefiles",
// "cmake.copyCompileCommands": "", // 成功配置后,将 compile_commands.json 复制到此位置
// jupyter
"jupyter.askForKernelRestart": false,
"jupyter.interactiveWindow.creationMode": "perFile",
// Jupyter notebook
"notebook.lineNumbers": "on",
"notebook.stickyScroll.enabled": true,
// remote
"remote.SSH.remotePlatform": {
"192.168.101.51": "linux",
"192.168.2.114": "linux",
"10.0.102.60": "linux",
"192.168.100.167": "linux"
},
"remote.autoForwardPortsSource": "hybrid",
"remote.extensionKind": {
"GitHub.copilot": [
"ui"
],
"github.copilot-chat": [
"ui"
]
},
// python
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"isort.args": [
"--profile",
"black"
],
// pylint
"pylint.args": [
"--max-line-length=120",
"--disable=C0103, C0114, C0115, C0116, W1514",
],
// cpp
"[cpp]": {
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
},
}