vscode中的launch.json中不允许使用属性args [英] Property args is not allowed in launch.json in vscode

查看:1190
本文介绍了vscode中的launch.json中不允许使用属性args的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在vscode中的launch.json文件中添加一些基本配置,但是由于不允许使用属性args而出现错误.以下是我的配置.

I am just trying to add some basic configuration to my launch.json file in vscode, but I am getting an error as Property args is not allowed. Below is my configuration.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "index",         
            "args": [
                "src/index.ts"
            ],
            "cwd": "${workspaceFolder}"           
        }
    ],
    "compounds": []
}

推荐答案

那是一个愚蠢的错误.根据此文档

That was a silly mistake. According to this doc

VS Code调试器通常支持以调试模式启动程序 或以调试模式附加到已在运行的程序.根据 请求(附加或启动)的不同属性是必需的,并且 VS Code的launch.json验证和建议应有助于 那个.

VS Code debuggers typically support launching a program in debug mode or attaching to an already running program in debug mode. Depending on the request (attach or launch) different attributes are required and VS Code's launch.json validation and suggestions should help with that.

因此,当我将请求从attach更改为launch时,一切都非常完美.仅请求类型launch支持配置args.

So when I changed my request to launch from attach, everything was perfect. Only the request type launch supports the configuration args.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "index",         
            "args": [
                "src/index.ts"
            ],
            "cwd": "${workspaceFolder}"           
        }
    ],
    "compounds": []
}

这篇关于vscode中的launch.json中不允许使用属性args的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆