配置tasks.json
1.打开VS Code,点击“终端”,选择“配置任务”。
2.选择“使用模板创建tasks.json文件”。
3.选择“Others”。
4.tasks.json新建完成,默认如下图:
5.修改tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
“version”: “2.0.0”,
“tasks”: [
{
“label”: “在Chrome中运行”,
“type”: “process”, // [shell,process]
“command”: “Chrome”,
“args”: [“
f
i
l
e
"
]
,
"
w
i
n
d
o
w
s
"
:
"
c
o
m
m
a
n
d
"
:
"
C
:
/
P
r
o
g
r
a
m
F
i
l
e
s
(
x
86
)
/
G
o
o
g
l
e
/
C
h
r
o
m
e
/
A
p
p
l
i
c
a
t
i
o
n
/
c
h
r
o
m
e
.
e
x
e
"
,
"
g
r
o
u
p
"
:
"
b
u
i
l
d
"
,
"
p
r
e
s
e
n
t
a
t
i
o
n
"
:
/
/
R
e
v
e
a
l
t
h
e
o
u
t
p
u
t
o
n
l
y
i
f
u
n
r
e
c
o
g
n
i
z
e
d
e
r
r
o
r
s
o
c
c
u
r
.
"
r
e
v
e
a
l
"
:
"
n
e
v
e
r
"
/
/
[
a
l
w
a
y
s
,
n
e
v
e
r
,
s
i
l
e
n
t
]
,
/
/
U
s
e
t
h
e
s
t
a
n
d
a
r
d
M
S
c
o
m
p
i
l
e
r
p
a
t
t
e
r
n
t
o
d
e
t
e
c
t
e
r
r
o
r
s
,
w
a
r
n
i
n
g
s
a
n
d
i
n
f
o
s
"
p
r
o
b
l
e
m
M
a
t
c
h
e
r
"
:
"
{file}"], "windows": { "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" }, "group": "build", "presentation": { // Reveal the output only if unrecognized errors occur. "reveal": "never" //[always,never,silent] }, // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "
file"],"windows":"command":"C:/ProgramFiles(x86)/Google/Chrome/Application/chrome.exe","group":"build","presentation"://Revealtheoutputonlyifunrecognizederrorsoccur."reveal":"never"//[always,never,silent],//UsethestandardMScompilerpatterntodetecterrors,warningsandinfos"problemMatcher":"msCompile”
}
]
}
6.运行任务
选中需要运行的html文件,按住Ctrl+Shift+B,选择“在Chome中运行”,即可。
突然遇到的vscode打开浏览器一直都是首页的解决问题
最新推荐文章于 2024-03-10 22:43:10 发布