博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

vs code 配置在浏览器中打开文件

Posted on 2017-03-12 14:53  Teamus  阅读(644)  评论(0)    收藏  举报

  Visual Studio Code还不支持安装扩展,没有内置的HTML预览功能。如果想要编辑HTML之后直接运行,可以 ctrl+shift+p 搜索 Configure Task Runner. 回车之后打开 tasks.json,修成如下代码:

 

 1 {
 2     // See https://go.microsoft.com/fwlink/?LinkId=733558
 3     // for the documentation about the tasks.json format
 4     "version": "0.1.0",
 5     "command": "Chrome",
 6     "windows":{
 7         "command":"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
 8     },
 9     //"isShellCommand": true,
10     "args": ["${file}"],  //设置打开文件为当前文件
11     //"showOutput": "always"
12     "showOutput": "never"
13 }

 

可以发现,项目目录下多出了 .vscode 文件夹,并且tasks.json就在里面,也就是说这个配置是针对当前项目的,如果要在其他项目下使用,那就需要重新配置