且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

VS Code Plugins And Configuration

更新时间:2022-08-12 16:16:17

VS Code插件

  • vscode-icons: 显示文件类型的图标
  • project manager: 管理项目, 项目的保存加载与切换
  • beautify: 控制缩进
  • code runner: 执行代码
  • debugger for chrome
  • eslint: 代码规范检测
  • include autocomplete: 头文件自动补全, json配置文件为c_cpp_properties.json, 在includePath添加需要的头文件路径即可

内置

  • format document: 该命令控制全局缩进

快捷键

  • ctrl + tab: 选择历史文件
  • shift + cmd + p: 显示所有命令
  • cmd + n: 创建新文件到huffer中
  • cmd + s: 将buffer中的文件保存到指定目录下
  • 几乎所有的软件都支持的标签切换: shift + cmd + [ 以及 shift + cmd + ]
  • shift + cmd + V: 打开markdownd的预览
  • ctrl + shift + b: 编译, 根据task.json, 如果没有创建, 找模板
  • 编译运行 shift + cmd + b

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "compile", # 用于表示和引用task
            "command": "g++", # 命令名
            "args": ["${file}"] # 命令的参数, 有时使用的参数无效直接将该参数放到"command"中
        },
        {
            "label": "run",
            "args": ["build"],
            "options": {
                "cwd": "${workspaceRoot}/server"
            }
        },
        {   # 同时启动两个task
            "label": "Build",
            "dependsOn": ["compile", "run"],
            "group": [
                "kind": "build",
                "isDefault": true
            ]
        }
    ]
}

还有group选项, 有test或者build两个值, 使用命令run build task或者run test task
  • python: select interpretor --> 选择python解释器
  • launch.json使用默认的就好, 单击左侧的debug图标, 点击齿轮自动生成模板, 回到python源码文件, F5进行debug

  • windows中想要debugC程序就做梦去吧
  • 建议在windows中下载TDM-GCC配置好gcc, g++和gdb, vscode下载code runner插件
  • 但是在*nix中debug和build都可以