[英]Prettier in VS code splitting attributes onto multiple lines ( print width doesn't work for html ) Angular
I've searched a lot about it and tried so much solutions,我已经搜索了很多关于它并尝试了很多解决方案,
I'm using Angular when formatting html with prettier it's quite ugly because it wraps every single attribute to a new line eg:我在用 prettier 格式化 html 时使用 Angular 它非常难看,因为它将每个属性都包装到一个新行中,例如:
<button
pButton
class="btn"
type="button"
label="Add Item(s)"
(click)="handleClick()"
></button>
.prettierrc.json
file with {"printWidth": 100}
.prettierrc.json
文件{"printWidth": 100}
Important thing to note is that prettier is applying printWidth 80 something like built-in because I'm sure that it's not set in any settings by user, I have some attributes that are two per line when they quite little in space eg:需要注意的重要一点是 prettier 正在应用 printWidth 80 之类的东西,因为我确信它没有被用户设置在任何设置中,我有一些属性,当它们的空间很小时,每行两个,例如:
<div class="p-col-2" style="float: left">
{{ "modules.user.orderdisplay.quantity" | translate }}
</div>
You should also check for.editorconfig file - if it is present prettier will use it's values.您还应该检查 .editorconfig 文件——如果它存在,prettier 将使用它的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.