VsCode能否一键运行程序?比如按下F5
,直接运行npm run serve
;
答案是可以!!!
请往下看。
初始化(启用)
{
"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": [{
"type": "node",
"request": "launch",
"name": "serve",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceRoot}/node_modules/@vue/cli-service/bin/vue-cli-service.js",
"args": ["serve"]
}]
}
快捷键
F5
:启动调试
Ctrl
+ F5
:直接运行
Shift
+ F5
:终止调试
Ctrl
+ Shift
+ F5
:重启调试