在 Vscode 中编辑 Prettier 选项
Editing Prettier options in Vscode
我需要让 .tpl 文件像 HTML 一样被 Prettier 格式化。
I've found on GitHub 这段代码谁来做:
overrides: [
{
files: '*.html.tpl',
options: { parser: 'html' },
},
],
我该如何实施?
转到文件 -> 首选项 -> 设置。
在搜索框中,搜索 "Associations",然后单击 "Edit on settings.json"。
将以下内容添加到 JSON 文件:
"files.associations": {
"*.html.tpl": "html"
}
对于要使用的语法,您有多种选择。
这里是 JSON 中的一个例子:
//.prettierrc.json
{
"semi": false,
"overrides": [
{
"files": "*.html.tpl",
"options": { "parser": "html" },
},
],
}
您在 documentation 上有更多示例。
我需要让 .tpl 文件像 HTML 一样被 Prettier 格式化。 I've found on GitHub 这段代码谁来做:
overrides: [
{
files: '*.html.tpl',
options: { parser: 'html' },
},
],
我该如何实施?
转到文件 -> 首选项 -> 设置。
在搜索框中,搜索 "Associations",然后单击 "Edit on settings.json"。
将以下内容添加到 JSON 文件:
"files.associations": {
"*.html.tpl": "html"
}
对于要使用的语法,您有多种选择。
这里是 JSON 中的一个例子:
//.prettierrc.json
{
"semi": false,
"overrides": [
{
"files": "*.html.tpl",
"options": { "parser": "html" },
},
],
}
您在 documentation 上有更多示例。