我正在学习一些关于 dart 输入的教程,但似乎它只能在终端中运行。不幸的是,我一直得到这个错误**.vscode/launch.json:1:1:错误:应为声明,但得到“|”。{ ^**这是我的launch.json文件中的代码:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Dart & Flutter",
"request": "launch",
"type": "dart",
"program": ".vscode/launch.json",
"console": "externalTerminal"
}
]
}
下面是code --list - extensions的输出:
adelphes.android-dev-ext
Dart-Code.dart-code
Dart-Code.flutter
eamodio.gitlens
esbenp.prettier-vscode
formulahendry.code-runner
jeff-hykin.better-cpp-syntax
ms-azuretools.vscode-docker
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-wsl
ms-vscode.cmake-tools
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
PKief.material-icon-theme
streetsidesoftware.code-spell-checker
timkmecl.codegpt3
twxs.cmake
VisualStudioExptTeam.vscodeintellicode
1条答案
按热度按时间lsmepo6l1#
program
字段应该是一个Dart脚本,但您将其设置为launch.json本身:这应该是类似于
"lib/main.dart"
或"bin/main.dart"
。如果你想让Dart扩展从打开的文件/工作区中推断出
"program"
,你也可以完全删除它(如果打开的文件在bin/
,tool/
或test/
中,它会运行它,否则它会查找一些常见的文件,如bin/main.dart
)。