有没有办法在 vscode 中排除 html 行的格式? (我使用更漂亮的)例如:我像这样手动格式化:
<input
(keyup.enter)="createPost(title)"
#title type="text"
class="form-control" />
它会自动重新格式化为:
<input (keyup.enter)="createPost(title)" #title type="text" class="form-control" />
我尝试使用 pre
,它可以正常工作,但这不是很方便。
这是我最近(不舒服的)解决方案的例子;
<style>
pre {
white-space: normal;
padding: 0px;
margin: 0 0;
border: 0px;
}
</style>
<div>
**<pre>**
<input
(keyup.enter)="createPost(title)"
#title type="text"
class="form-control" />
**</pre>**
<!-- other HTML to be formatted -->
<ul class="list-group">
**<pre>**
<li
class="list-group-item"
*ngFor="let item of items">
<p>{{ item.body }}</p>
</li>
**</pre>**
</ul>
</div>
谢谢,公爵
最佳答案
VS Code 本身不执行任何语言的自动格式化。您需要查看您正在使用的扩展程序,以及它是否提供了在保存时禁用自动格式化等功能。
关于visual-studio-code - 有没有办法排除 html 行在 vscode 中被格式化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48248424/