VsCode能否一键运行程序?比如按下F5
,直接运行npm run serve
;
答案是可以!!!
请往下看。
初始化(启用)
{
// 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": [{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}\\app.js"
}]
}
会自动生成.vscode/launch.json
文件。
编辑启动配置文件
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": "Launch via NPM",
"request": "launch",
"runtimeArgs": [
"run",
"serve"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
}]
}
快捷键
F5
:启动调试
Ctrl
+ F5
:直接运行
Shift
+ F5
:终止调试
Ctrl
+ Shift
+ F5
:重启调试