vscode的配置

· · 个人记录

主题,括号颜色配置:

ctrl+shift+p打开命令,搜索“settings.json”,选择“首选项:打开用户设置(JSON)”,复制下文代码。

:::info[setting.json代码]

{
    "editor.bracketPairColorization.enabled": true,
    "editor.guides.bracketPairs": "active",
    "workbench.colorCustomizations": {
        "editorBracketHighlight.foreground1": "#ffd700",
        "editorBracketHighlight.foreground2": "#da70d6",
        "editorBracketHighlight.foreground3": "#179fff",
        "editorBracketHighlight.foreground4": "#24d600",
        "editorBracketHighlight.foreground5": "#00d8d8",
        "editorBracketHighlight.foreground6": "#ff89ba"
    },
    "workbench.colorTheme": "Shades of Purple (Super Dark)"
}

:::

C++代码片段配置:

ctrl+shift+p打开命令,搜索“snippets”,选择“代码片段:配置代码片段”,复制下文代码。

:::info[cpp.json代码]

{
    "cpp":{
        "prefix": "cpp",
        "body": ["#include<bits/stdc++.h>",
                "#define int long long",
                "#define double long double",
                "#define endl '\\n'",
                "using namespace std;",
                "const int N=3e5+7;",
                "int n;",
                "void mian(){",
                "    cin>>n;",
                "    return;",
                "}",
                "signed main(){",
                "    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);",
                "    int _77231=1;",
                "    // cin>>_77231;",
                "    while(_77231--)mian();",
                "    return 0;",
                "}$0"
            ],
        "description": "C++ template"
    }
}

:::

C++ vscode 生成exe:

在原文件同目录下创建“.vscode”文件夹,新建“tasks.json”,复制下文代码

:::info[tasks.json代码]

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件——编译运行",
            "command": "C:\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\#${fileBasenameNoExtension}#",
                "-std=c++26",
                "-O2",
                "-I\"C:\\mingw64\\include\"",
                "-I\"C:\\mingw64\\x86_64-w64-mingw32\\include\"",
                "-I\"C:\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\15.2.0\\include\"",
                "-I\"C:\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\15.2.0\\include\\c++\"",
                "-L\"C:\\mingw64\\lib\"",
                "-L\"C:\\mingw64\\x86_64-w64-mingw32\\lib\""
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

:::