[Windows]Visual Studio Code个人配置

编辑器要添加的

settings.json

打开这个:

[Windows]Visual Studio Code个人配置_第1张图片

 

{
    "editor.fontSize": 20,//编辑字号
    "files.autoSave": "afterDelay",//自动保存
    "workbench.colorTheme": "One Monokai",//主题
    "command-runner.commands": {
        "Run": "start cmd /c \"C:\\Program Files (x86)\\Dev-Cpp\\ConsolePauser.exe\" ${fileDirname}\\${fileBasenameNoExtension}"
    }//方便一键运行
}

 

第三个需要安装插件:

[Windows]Visual Studio Code个人配置_第2张图片

 

第四个需要安装插件:

 [Windows]Visual Studio Code个人配置_第3张图片

 keybindings.json

快捷键设置

打开位置同理

[
    {
        "key": "f11",
        "command": "workbench.action.tasks.build"
    },//编译运行
    {
        "key": "f10",
        "command": "command-runner.run",
        "args":{
            "command": "Run"
        },
        "when": "editorTextFocus"
    }//运行,配合上面的command runner插件
]

每个文件内

想要进行编译:

c_cpp_properties.json

配置编译器位置和语言

{
    "configurations": [
        {
            "name": "MinGW",
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/g++.exe",//编译器位置,安装Dev C++才有这个路径。。。
            "includePath": [
                "${workspaceFolder}"
            ],
            "cStandard": "c11",
            "cppStandard": "c++11"
        }
    ],
    "version": 4
}

settings.json

暂时不知道有什么用

{
    "files.associations": {
        "array": "cpp",
        "atomic": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "cctype": "cpp",
        "cfenv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "complex": "cpp",
        "condition_variable": "cpp",
        "csetjmp": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "forward_list": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "fstream": "cpp",
        "functional": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "numeric": "cpp",
        "ratio": "cpp",
        "scoped_allocator": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "system_error": "cpp",
        "thread": "cpp",
        "type_traits": "cpp",
        "tuple": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "utility": "cpp",
        "valarray": "cpp"
    }
}

tasks.json

编译命令

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile",
            "type": "shell",
            "command": "g++ -Wall -std=c++11 -O2 -Wl,-stack=512000000 \"${file}\" -o \"${fileDirname}\\${fileBasenameNoExtension}\" && start cmd /c \"C:\\Program Files (x86)\\Dev-Cpp\\ConsolePauser.exe\" ${fileDirname}\\${fileBasenameNoExtension}",
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Run",
            "type": "shell",
            "command": "start cmd /c \"C:\\Program Files (x86)\\Dev-Cpp\\ConsolePauser.exe\" ${fileDirname}\\${fileBasenameNoExtension}",
            "problemMatcher": []
        },
        {
            "type": "shell",
            "label": "g++.exe build active file",
            "command": "C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:/Program Files (x86)/Dev-Cpp/MinGW64/bin"
            }
        }
    ]
}

额外插件

除了上述两个

还有:

[Windows]Visual Studio Code个人配置_第4张图片 

前两个是C++语言的配置

最后一个是中文汉化

效果图

[Windows]Visual Studio Code个人配置_第5张图片

 

转载于:https://www.cnblogs.com/Miracevin/p/10986522.html

你可能感兴趣的:([Windows]Visual Studio Code个人配置)