"launch.json\" 中缺少配置“run current file”。"
时间: 2023-08-02 22:03:08 浏览: 125
在 Visual Studio Code 中,我们可以使用 "launch.json" 文件来配置调试器的行为。该文件包含了多个调试配置,用于指定在调试过程中运行的应用程序或脚本的细节。
"launch.json" 文件是一个 JSON 格式的文件,通过编辑该文件中的设置,我们可以在其中添加和配置各种调试任务。通常情况下,我们可以通过在该文件中添加一个新的配置来解决缺少 "run current file" 的问题。
下面是一个示例的 "launch.json" 文件中的配置:
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Current File",
"type": "node",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
```
在上面的配置中,我们创建了一个名为 "Run Current File" 的调试配置。它的 "type" 属性设置为 "node",表示我们要运行的是一个 Node.js 程序。"request" 属性设置为 "launch",表示我们要启动一个新的调试会话。"program" 属性设置为 "${file}",表示我们要运行当前打开的文件。
通过将上述配置添加到 "launch.json" 文件中,我们就可以在 Visual Studio Code 中使用 "Run Current File" 来运行当前打开的文件了。