• 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
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147

    (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,
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146

    (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,
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146

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

  • 相关阅读:
    Visual Studio Code 从英文界面切换中文
    【C语言刷题】牛客网刷题——替换空格
    c++自定义sort()函数的排序方法
    【Redis 多机服务的简单认识】
    wpf复制xaml及其cs窗体到其他项目 添加现有项,选 .xaml.cs,点添加即可。VS2022
    Java工具库Guava本地缓存Cache的使用、回收、刷新、统计等示例
    1、SpringCloud大型企业分布式微服务云架构之Markdown 教程
    C++面试100问!(二)
    抖音seo矩阵系统源代码部署及产品功能设计分析
    AtCoder Beginner Contest 261 部分题解
  • 原文地址:https://blog.csdn.net/tiandyoin/article/details/126772665