[Windows]Visual Studio Code个人配置

Posted miracevin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Windows]Visual Studio Code个人配置相关的知识,希望对你有一定的参考价值。

编辑器要添加的

settings.json

打开这个:

技术图片

 


    "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"
    //方便一键运行

 

第三个需要安装插件:

技术图片

 

第四个需要安装插件:

 技术图片

 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"
            
        
    ]

额外插件

除了上述两个

还有:

技术图片 

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

最后一个是中文汉化

效果图

技术图片

 

以上是关于[Windows]Visual Studio Code个人配置的主要内容,如果未能解决你的问题,请参考以下文章

Visual Studio2005问题:未能正确加载包“Visual Studio Macros Package”

Visual Studio中的Android文档

Windows 7 上安装Visual Studio 2015 失败解决方案

visual studio 2008如何引用dll

visual studio 2013 中更改C#项目的 Framework 版本

Visual Studio 2005 C++ 编译器比 Visual Studio 6 编译器慢?