gpt4 book ai didi

html - 如何防止 VS Code 将长 HTML 行分解为多行?

转载 作者:搜寻专家 更新时间:2023-10-31 23:15:59 32 4
gpt4 key购买 nike

当我的带有属性的元素变长时,VS Code 似乎将行分成多行:

enter image description here

(这里我想要三行而不是七行,每个元素一行)

我正在使用 prettier 进行格式化,并设置了 printWidth 选项,该选项在 javascript 代码中有效,但对于 HTML,它似乎被 VS Code 覆盖了。

我试过摆弄 wrapAttributeshtml.format.wrapLineLength 设置,但这些似乎都没有任何效果。

这件事情怎么处理?

更新:

非常感谢您的回答。我还没有收到他们的通知,很抱歉没有采取行动。

我已经尝试了您的所有建议,但问题仍然存在。这是根据您的建议我当前的配置。

设置.json:

"html.format.wrapLineLength": 0,
"html.format.enable": false,
"html.format.wrapAttributes": "auto",
"vetur.format.defaultFormatterOptions": {
"prettyhtml": {
"printWidth": 300,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
}

.prettierrc.json:

{
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 300,
"tabWidth": 2,
"useTabs": true,
"jsxBracketSameLine": true
}

最佳答案

你可以在settings.json中添加"html.format.wrapLineLength": 0

关于html - 如何防止 VS Code 将长 HTML 行分解为多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56112054/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com