IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 开发工具 -> json对齐行尾的注释 - 在vscode格式化 -> 正文阅读

[开发工具]json对齐行尾的注释 - 在vscode格式化

天龙八步:
(1) 先以json方式格式化,对齐缩进。
(2) 去除中文空格
正则查找: " " 换成 " "
(3) //" 换成 // "
正则查找: //"
替换框写: // "
(4) 第2个 // 前面补 100 个空格
末尾注释 // 非//字符串,去除空格
正则查找: ([^\s:/]+)([\s]*)//([\s]*)(?!.*//.*)(.*)$
替换框写: $1$2          // $4
重复替换: 5次。
(**注意!**这里是中文空格,不要直接拷贝,请改成英文空格。因为csdn会把空格抹掉,这里我只能用中文空格撑场面。)
(5) 找到有效键值的最长的一个,找到它的末尾逗号的位置P
或者 /----------------------------------------------------------------------------/
的末尾位置,应该足够长了。
一般最短 5, 最长 80-100。
正则查找: ^[^,]*,
(6) 列模式,在每行的 位置P 后加入 一长列 ||||
假设P=73
正则查找: ^([\s\S]{73})
替换框写: $1||||
(7) 去除 |||| // 之间的空格,包括去除 ||||
正则查找: \|\|\|\|([\s]*)
替换框写:
(8) 在beyond compare 里比较修正。
九阴真经
settings.json里的"workbench.colorCustomizations" 项里的颜色项会显示一个颜色小方
块在颜色值的前面。它占用两个空格,对齐时要考虑留两个空位给它。
(9) 在未注释掉的颜色键值对的,逗号后面删除两个空格
正则查找: ^([^/]+#[^/]+,)([\s]{2})
替换框写: $1


(0) 先发测试案例。

{
  // 代码风格依赖颜色主题:Light (Visual Studio C/C++)
  "security.workspace.trust.untrustedFiles": "open",
  "editor.tabSize": 2,
  "editor.tokenColorCustomizations": {},
  "workbench.colorCustomizations": {
    //全 整体布局
    // "welcomePage.tileBackground": "#ff0000",  // 欢迎页上的磁帖
    "contrastBorder": "#C49F7980", // 元素外边框
     "widget.shadow": "#98816B80", //              查找等控件边框颜色,取滚动条的半透明灰色
    /*-------------------------------------------------------------------  */
    //上 标题栏
"titleBar.activeForeground": "#808080", //    (只是面板,非上面的文字)
    // "debugTokenExpression.number":"#ff0000",
    //"debugTokenExpression.error":"#ff0000"
    //中  编辑器文本                             //其它
    /*--------------------------------
    吸sdfw'fw辑eocp//:,efef//{
    -----------------------------------  */
    // "debugConsole.errorForeground": "#ff0000",
    "debugConsoleInputIcon.foreground": "#0060C0",
    //中 编辑器子层控件
    //"editor.inlineValuesForeground":"#ff0000",                // 调试时内联值(变量实际值显示在变量旁边)前景色
    // "editor.focusedStackFrameHighlightBackground":"#ff0000",  // 栈帧中焦点一行 (即跳到历史执行代码行)的高亮背景色
    // "editor.stackFrameHighlightBackground":"#ff0000", //         堆栈帧中顶部一行(即当前调试代码行)的高亮背景色
    "debugToolBar.background": "#CFA983", //                      调试工具栏
    "list.inactiveFocusBackground": "#ba9570",
    "list.hoverForeground": "#ffffff",//
    //右  辅助侧边栏//
    // ...... // //
    // "diffEditorOverview.removedForeground" //
     /*----------------------------------------------------------------------------*/
    // 笔记本
    // 酷炫?https://zhuanlan.zhihu.com/p/366596949
    // "notebook.editorBackground":"#ff0000",
    // "notebookScrollbarSlider.background":"#ff0000",
    "notebookStatusErrorIcon.foreground": "#ff0000",
    /*----------------------------------------------------------------------------*/
    /// 
    /// 代码格式化
    /// https://clang.llvm.org/docs/ClangFormatStyleOptions.html/
    ///
    "minimap.background": "#C49F79"
    // 配色方案
    //                             调试工具栏    终端
    // 文件标题栏   缩略图             查找      编辑器     输入框
    //  #ba9570 < #C49F79 < C49F79 < #CFA983 < #ddb890  < #ebc8a4
  },
  // "terminal.external.windowsExec": "C:/cygwin64/bin/mintty.exe",
  // "terminal.integrated.profiles.linux": {
  //   "bash": {
  //     "path": "C:\\Cygwin64\\bin\\bash.exe",
  //     "icon": "terminal-bash"
  //   },
  //   "zsh": {
  //     "path": "zsh"
  //   },
  //   "fish": {
  //     "path": "fish"
  //   },
  //   "tmux": {
  //     "path": "tmux",
  //     "icon": "terminal-tmux"
  //   },
  //   "pwsh": {
  //     "path": "pwsh",
  //     "icon": "terminal-powershell"
  //   }
  // },
  "terminal.integrated.profiles.windows": {
    "Cygwin": {
      "path": "C:\\Cygwin64\\bin\\bash.exe",
      // "path": "C:\\Cygwin64\\Cygwin.bat",
      "env": {
        // "MAKE_MODE":"UNIX"
        // "PATH": "C:\\Cygwin64\\bin;%PATH%",
        // "HOME": "C:\\Cygwin64\\home\\Lin"
      },
      "args": [
        "--login"
        // "-i"
      ],
      "icon": "terminal-bash"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\System32\\cmd.exe",
        "${env:windir}\\Sysnative\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },
   // "C_Cpp.default.systemIncludePath": [
  //   "D:/Program Files/boost_1_65_1/boost/**"
  // ],
   C/C++ 扩展的配置
  // "C_Cpp.clang_format_path": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  // "editor.defaultFormatter": "ms-vscode.cpptools",
  // "[cpp]": {
  //   "editor.defaultFormatter": "ms-vscode.cpptools"
  // },
  "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AllowShortCaseLabelsOnASingleLine: true, AlignConsecutiveDeclarations: true, AllowShortFunctionsOnASingleLine: All, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Json, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Cpp, PointerAlignment: Right, SortIncludes: true, BreakBeforeBraces: Linux, AlignAfterOpenBracket: true, AlignConsecutiveAssignments: true, AlignConsecutiveMacros : true, AlwaysBreakAfterReturnType: None, PenaltyReturnTypeOnItsOwnLine: 9999 }",
  "C_Cpp.clang_format_style": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3 }",
  "C_Cpp.formatting": "Default",
  "csharp.format.enable": true,
  "json.format.enable": true,
  "javascript.format.enable": true,
   clang-format 扩展的配置
  "files.associations": {
    "*.clang-format*": "yaml",
  },
  "clang-format.language.csharp.enable": true,
  "clang-format.language.c.enable": true,
  "clang-format.language.objective-c.enable": true,
  "clang-format.language.java.enable": true,
  "clang-format.language.javascript.enable": true,
  // "clang-format.executable": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  "clang-format.executable": "D:/Program Files/LLVM15/bin/clang-format.exe", // EXE下载: https://github.com/llvm/llvm-project/releases
  "editor.defaultFormatter": "mjohns.clang-format",
  // "[cpp]": {
  //   "editor.defaultFormatter": "mjohns.clang-format",
  // },
  // 从(当前目录->工作目录->path变量)查找默认配置文件(.clang-format)并读取格式化风格。找不到则使用fallbackStyle, 没有fallbackStyle则默认LLVM,C++.
  "clang-format.style" : "file",                        
  // "clang-format.style" : "file:D:/Users/tiandyoin/Desktop/Test/n  中文 n/.google.cpp.clang-format", //可以有中文和空格
  // "clang-format.style" : "file:./.Google.cs.clang-format", // 从指定配置文件读取格式化风格。找不到文件会报错。
  // 经测试,assumeFilename 有两个作用:
  // (1)在输出配置文件时,给合本选项,确定输出配置文件的language.
  // (2)在读取配置文件时,按后缀名分析取出相应的语言的配置部分来格式化代码。
  //    如 "--assume-filename=.cs" 表示使用配置文件里的 language:CSharp 部分来格式化代码。
  //    如果找不到 CSharp 部分会报错。没有给出该项时,默认 c++.
  // "clang-format.assumeFilename": ".cs", 
  "clang-format.assumeFilename": ".js", 
  "clang-format.fallbackStyle": "Google",
   clang-format-checker 扩展的配置
  // "clang-format-checker.clangFormatExecutable": "D:/Program Files/LLVM/bin/clang-format.exe",
  // "clang-format-checker.checkOnChange": true,
}

(1) 先以json方式格式化,对齐缩进。

{
  // 代码风格依赖颜色主题:Light (Visual Studio C/C++)
  "security.workspace.trust.untrustedFiles": "open",
  "editor.tabSize": 2,
  "editor.tokenColorCustomizations": {},
  "workbench.colorCustomizations": {
    //全 整体布局
    // "welcomePage.tileBackground": "#ff0000",  // 欢迎页上的磁帖
    "contrastBorder": "#C49F7980", // 元素外边框
    "widget.shadow": "#98816B80", //              查找等控件边框颜色,取滚动条的半透明灰色
    /*-------------------------------------------------------------------  */
    //上 标题栏
    "titleBar.activeForeground": "#808080", //    (只是面板,非上面的文字)
    // "debugTokenExpression.number":"#ff0000",
    //"debugTokenExpression.error":"#ff0000"
    //中  编辑器文本                             //其它
    /*--------------------------------
    吸sdfw'fw辑eocp//:,efef//{
    -----------------------------------  */
    // "debugConsole.errorForeground": "#ff0000",
    "debugConsoleInputIcon.foreground": "#0060C0",
    //中 编辑器子层控件
    //"editor.inlineValuesForeground":"#ff0000",                // 调试时内联值(变量实际值显示在变量旁边)前景色
    // "editor.focusedStackFrameHighlightBackground":"#ff0000",  // 栈帧中焦点一行 (即跳到历史执行代码行)的高亮背景色
    // "editor.stackFrameHighlightBackground":"#ff0000", //         堆栈帧中顶部一行(即当前调试代码行)的高亮背景色
    "debugToolBar.background": "#CFA983", //                      调试工具栏
    "list.inactiveFocusBackground": "#ba9570",
    "list.hoverForeground": "#ffffff", //
    //右  辅助侧边栏//
    // ...... // //
    // "diffEditorOverview.removedForeground" //
    /*----------------------------------------------------------------------------*/
    // 笔记本
    // 酷炫?https://zhuanlan.zhihu.com/p/366596949
    // "notebook.editorBackground":"#ff0000",
    // "notebookScrollbarSlider.background":"#ff0000",
    "notebookStatusErrorIcon.foreground": "#ff0000",
    /*----------------------------------------------------------------------------*/
    /// 
    /// 代码格式化
    /// https://clang.llvm.org/docs/ClangFormatStyleOptions.html/
    ///
    "minimap.background": "#C49F79"
    // 配色方案
    //                             调试工具栏    终端
    // 文件标题栏   缩略图             查找      编辑器     输入框
    //  #ba9570 < #C49F79 < C49F79 < #CFA983 < #ddb890  < #ebc8a4
  },
  // "terminal.external.windowsExec": "C:/cygwin64/bin/mintty.exe",
  // "terminal.integrated.profiles.linux": {
  //   "bash": {
  //     "path": "C:\\Cygwin64\\bin\\bash.exe",
  //     "icon": "terminal-bash"
  //   },
  //   "zsh": {
  //     "path": "zsh"
  //   },
  //   "fish": {
  //     "path": "fish"
  //   },
  //   "tmux": {
  //     "path": "tmux",
  //     "icon": "terminal-tmux"
  //   },
  //   "pwsh": {
  //     "path": "pwsh",
  //     "icon": "terminal-powershell"
  //   }
  // },
  "terminal.integrated.profiles.windows": {
    "Cygwin": {
      "path": "C:\\Cygwin64\\bin\\bash.exe",
      // "path": "C:\\Cygwin64\\Cygwin.bat",
      "env": {
        // "MAKE_MODE":"UNIX"
        // "PATH": "C:\\Cygwin64\\bin;%PATH%",
        // "HOME": "C:\\Cygwin64\\home\\Lin"
      },
      "args": [
        "--login"
        // "-i"
      ],
      "icon": "terminal-bash"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\System32\\cmd.exe",
        "${env:windir}\\Sysnative\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },
  // "C_Cpp.default.systemIncludePath": [
  //   "D:/Program Files/boost_1_65_1/boost/**"
  // ],
   C/C++ 扩展的配置
  // "C_Cpp.clang_format_path": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  // "editor.defaultFormatter": "ms-vscode.cpptools",
  // "[cpp]": {
  //   "editor.defaultFormatter": "ms-vscode.cpptools"
  // },
  "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AllowShortCaseLabelsOnASingleLine: true, AlignConsecutiveDeclarations: true, AllowShortFunctionsOnASingleLine: All, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Json, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Cpp, PointerAlignment: Right, SortIncludes: true, BreakBeforeBraces: Linux, AlignAfterOpenBracket: true, AlignConsecutiveAssignments: true, AlignConsecutiveMacros : true, AlwaysBreakAfterReturnType: None, PenaltyReturnTypeOnItsOwnLine: 9999 }",
  "C_Cpp.clang_format_style": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3 }",
  "C_Cpp.formatting": "Default",
  "csharp.format.enable": true,
  "json.format.enable": true,
  "javascript.format.enable": true,
   clang-format 扩展的配置
  "files.associations": {
    "*.clang-format*": "yaml",
  },
  "clang-format.language.csharp.enable": true,
  "clang-format.language.c.enable": true,
  "clang-format.language.objective-c.enable": true,
  "clang-format.language.java.enable": true,
  "clang-format.language.javascript.enable": true,
  // "clang-format.executable": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  "clang-format.executable": "D:/Program Files/LLVM15/bin/clang-format.exe", // EXE下载: https://github.com/llvm/llvm-project/releases
  "editor.defaultFormatter": "mjohns.clang-format",
  // "[cpp]": {
  //   "editor.defaultFormatter": "mjohns.clang-format",
  // },
  // 从(当前目录->工作目录->path变量)查找默认配置文件(.clang-format)并读取格式化风格。找不到则使用fallbackStyle, 没有fallbackStyle则默认LLVM,C++.
  "clang-format.style": "file",
  // "clang-format.style" : "file:D:/Users/tiandyoin/Desktop/Test/n  中文 n/.google.cpp.clang-format", //可以有中文和空格
  // "clang-format.style" : "file:./.Google.cs.clang-format", // 从指定配置文件读取格式化风格。找不到文件会报错。
  // 经测试,assumeFilename 有两个作用:
  // (1)在输出配置文件时,给合本选项,确定输出配置文件的language.
  // (2)在读取配置文件时,按后缀名分析取出相应的语言的配置部分来格式化代码。
  //    如 "--assume-filename=.cs" 表示使用配置文件里的 language:CSharp 部分来格式化代码。
  //    如果找不到 CSharp 部分会报错。没有给出该项时,默认 c++.
  // "clang-format.assumeFilename": ".cs", 
  "clang-format.assumeFilename": ".js",
  "clang-format.fallbackStyle": "Google",
   clang-format-checker 扩展的配置
  // "clang-format-checker.clangFormatExecutable": "D:/Program Files/LLVM/bin/clang-format.exe",
  // "clang-format-checker.checkOnChange": true,
}

(2) 去除中文空格
正则查找: " " 换成 " "
在这里插入图片描述
(3) //" 换成 // "
正则查找: //"
替换框写: // "
在这里插入图片描述
(4) 第2个 // 前面补 100 个空格
末尾注释 // 非//字符串,去除空格
正则查找: ([^\s:/]+)([\s]*)//([\s]*)(?!.*//.*)(.*)$
替换框写: $1$2          // $4
重复替换: 5次。
(**注意!**这里是中文空格,不要直接拷贝,请改成英文空格。因为csdn会把空格抹掉,这里我只能用中文空格撑场面。)
在这里插入图片描述
(5) 找到有效键值的最长的一个,找到它的末尾逗号的位置P
或者 /----------------------------------------------------------------------------/
的末尾位置,应该足够长了。
一般最短 5, 最长 80-100。
正则查找: ^[^,]*,
在这里插入图片描述
(6) 列模式,在每行的 位置P 后加入 一长列 ||||
假设P=73
正则查找: ^([\s\S]{73})
替换框写: $1||||
在这里插入图片描述
(7) 去除 |||| // 之间的空格,包括去除 ||||
正则查找: \|\|\|\|([\s]*)
替换框写:
在这里插入图片描述
(8) 在beyond compare 里比较修正。

{
  // 代码风格依赖颜色主题:Light (Visual Studio C/C++)
  "security.workspace.trust.untrustedFiles": "open",
  "editor.tabSize": 2,
  "editor.tokenColorCustomizations": {},
  "workbench.colorCustomizations": {
    //全 整体布局
    // "welcomePage.tileBackground": "#ff0000",                          // 欢迎页上的磁帖
    "contrastBorder": "#C49F7980",                                       // 元素外边框
    "widget.shadow": "#98816B80",                                        // 查找等控件边框颜色,取滚动条的半透明灰色
    /*-------------------------------------------------------------------*/
    //上 标题栏
    "titleBar.activeForeground": "#808080",                              // (只是面板,非上面的文字)
    // "debugTokenExpression.number":"#ff0000",
    //"debugTokenExpression.error":"#ff0000"
    //中  编辑器文本                                                           // 其它
    /*--------------------------------
    吸sdfw'fw辑eocp//:,efef                                                // {
    -----------------------------------  */
    // "debugConsole.errorForeground": "#ff0000",
    "debugConsoleInputIcon.foreground": "#0060C0",
    //中 编辑器子层控件
    //"editor.inlineValuesForeground":"#ff0000",                         // 调试时内联值(变量实际值显示在变量旁边)前景色
    // "editor.focusedStackFrameHighlightBackground":"#ff0000",          // 栈帧中焦点一行 (即跳到历史执行代码行)的高亮背景色
    // "editor.stackFrameHighlightBackground":"#ff0000",                 // 堆栈帧中顶部一行(即当前调试代码行)的高亮背景色
    "debugToolBar.background": "#CFA983",                                // 调试工具栏
    "list.inactiveFocusBackground": "#ba9570",
    "list.hoverForeground": "#ffffff",                                   // 
    //右  辅助侧边栏                                                           // 
    // ...... // //
    // "diffEditorOverview.removedForeground"                            // 
    /*----------------------------------------------------------------------------*/
    // 笔记本
    // 酷炫?https://zhuanlan.zhihu.com/p/366596949
    // "notebook.editorBackground":"#ff0000",
    // "notebookScrollbarSlider.background":"#ff0000",
    "notebookStatusErrorIcon.foreground": "#ff0000",
    /*----------------------------------------------------------------------------*/
    /// 
    /// 代码格式化
    /// https://clang.llvm.org/docs/ClangFormatStyleOptions.html/
    ///
    "minimap.background": "#C49F79"
    // 配色方案
    //                             调试工具栏    终端
    // 文件标题栏   缩略图             查找      编辑器     输入框
    //  #ba9570 < #C49F79 < C49F79 < #CFA983 < #ddb890  < #ebc8a4
  },
  // "terminal.external.windowsExec": "C:/cygwin64/bin/mintty.exe",
  // "terminal.integrated.profiles.linux": {
  //   "bash": {
  //     "path": "C:\\Cygwin64\\bin\\bash.exe",
  //     "icon": "terminal-bash"
  //   },
  //   "zsh": {
  //     "path": "zsh"
  //   },
  //   "fish": {
  //     "path": "fish"
  //   },
  //   "tmux": {
  //     "path": "tmux",
  //     "icon": "terminal-tmux"
  //   },
  //   "pwsh": {
  //     "path": "pwsh",
  //     "icon": "terminal-powershell"
  //   }
  // },
  "terminal.integrated.profiles.windows": {
    "Cygwin": {
      "path": "C:\\Cygwin64\\bin\\bash.exe",
      // "path": "C:\\Cygwin64\\Cygwin.bat",
      "env": {
        // "MAKE_MODE":"UNIX"
        // "PATH": "C:\\Cygwin64\\bin;%PATH%",
        // "HOME": "C:\\Cygwin64\\home\\Lin"
      },
      "args": [
        "--login"
        // "-i"
      ],
      "icon": "terminal-bash"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\System32\\cmd.exe",
        "${env:windir}\\Sysnative\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },
  // "C_Cpp.default.systemIncludePath": [
  //   "D:/Program Files/boost_1_65_1/boost/**"
  // ],
   C/C++ 扩展的配置
  // "C_Cpp.clang_format_path": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  // "editor.defaultFormatter": "ms-vscode.cpptools",
  // "[cpp]": {
  //   "editor.defaultFormatter": "ms-vscode.cpptools"
  // },
  "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AllowShortCaseLabelsOnASingleLine: true, AlignConsecutiveDeclarations: true, AllowShortFunctionsOnASingleLine: All, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Json, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3, Language: Cpp, PointerAlignment: Right, SortIncludes: true, BreakBeforeBraces: Linux, AlignAfterOpenBracket: true, AlignConsecutiveAssignments: true, AlignConsecutiveMacros : true, AlwaysBreakAfterReturnType: None, PenaltyReturnTypeOnItsOwnLine: 9999 }",
  "C_Cpp.clang_format_style": "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0, AlignTrailingComments: true, SpacesBeforeTrailingComments: 3 }",
  "C_Cpp.formatting": "Default",
  "csharp.format.enable": true,
  "json.format.enable": true,
  "javascript.format.enable": true,
   clang-format 扩展的配置
  "files.associations": {
    "*.clang-format*": "yaml",
  },
  "clang-format.language.csharp.enable": true,
  "clang-format.language.c.enable": true,
  "clang-format.language.objective-c.enable": true,
  "clang-format.language.java.enable": true,
  "clang-format.language.javascript.enable": true,
  // "clang-format.executable": "D:/Program Files/.vscode/extensions/ms-vscode.cpptools-1.12.4-win32-x64/LLVM/bin/clang-format.exe",
  "clang-format.executable": "D:/Program Files/LLVM15/bin/clang-format.exe", // EXE下载: https://github.com/llvm/llvm-project/releases
  "editor.defaultFormatter": "mjohns.clang-format",
  // "[cpp]": {
  //   "editor.defaultFormatter": "mjohns.clang-format",
  // },
  // 从(当前目录->工作目录->path变量)查找默认配置文件(.clang-format)并读取格式化风格。找不到则使用fallbackStyle, 没有fallbackStyle则默认LLVM,C++.
  "clang-format.style": "file",
  // "clang-format.style" : "file:D:/Users/tiandyoin/Desktop/Test/n  中文 n/.google.cpp.clang-format",                                                                                                                         // 可以有中文和空格
  // "clang-format.style" : "file:./.Google.cs.clang-format",            // 从指定配置文件读取格式化风格。找不到文件会报错。
  // 经测试,assumeFilename 有两个作用:
  // (1)在输出配置文件时,给合本选项,确定输出配置文件的language.
  // (2)在读取配置文件时,按后缀名分析取出相应的语言的配置部分来格式化代码。
  //    如 "--assume-filename=.cs" 表示使用配置文件里的 language:CSharp 部分来格式化代码。
  //    如果找不到 CSharp 部分会报错。没有给出该项时,默认 c++.
  // "clang-format.assumeFilename": ".cs", 
  "clang-format.assumeFilename": ".js",
  "clang-format.fallbackStyle": "Google",
   clang-format-checker 扩展的配置
  // "clang-format-checker.clangFormatExecutable": "D:/Program Files/LLVM/bin/clang-format.exe",
  // "clang-format-checker.checkOnChange": true,
}

比较结果图
(9) 在未注释掉的颜色键值对的,逗号后面删除两个空格
正则查找: ^([^/]+#[^/]+,)([\s]{2})
替换框写: $1
在这里插入图片描述

  开发工具 最新文章
Postman接口测试之Mock快速入门
ASCII码空格替换查表_最全ASCII码对照表0-2
如何使用 ssh 建立 socks 代理
Typora配合PicGo阿里云图床配置
SoapUI、Jmeter、Postman三种接口测试工具的
github用相对路径显示图片_GitHub 中 readm
Windows编译g2o及其g2o viewer
解决jupyter notebook无法连接/ jupyter连接
Git恢复到之前版本
VScode常用快捷键
上一篇文章      下一篇文章      查看所有文章
加:2022-09-13 11:38:53  更:2022-09-13 11:39:51 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/18 13:02:30-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码