vscode中的launch.json中不允许使用属性args [英] Property args is not allowed in launch.json in vscode
问题描述
我只是想在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屋!