Pau*_*ool 14 visual-studio-code
在我们的团队中,有些人使用 Webstorm,其他人使用 Visual Studio Code。当用户将属性放在新行上时,Webstorm 会垂直对齐它们。它将与行中的最后一个属性对齐。Visual Studio Code 有一个设置,您可以在其中包装格式属性,但它包装所有属性。
如果两个编辑器都能处理相同的格式,那就太好了。
我在 Visual Studio Code 中尝试了几个扩展(Prettier、Beautify、Alignment、Code alignment、Better Align),但没有一个能达到我想要的效果。有没有人知道我可能错过的任何设置或扩展可以满足我的需求?还是在 Visual Studio Code 中根本不可能?
用户设置
"html.format.wrapAttributes": "force-aligned",
Run Code Online (Sandbox Code Playgroud)
结果(VS Code 如何对齐属性)
<input type="text"
name="input_name"
placeholder="What's your name">
Run Code Online (Sandbox Code Playgroud)
期望的结果(Webstorm 如何对齐属性)
<input type="text" name="input_name"
placeholder="What's your name">
Run Code Online (Sandbox Code Playgroud)
小智 14
尝试这些html.format.wrapAttributes设置选项。
// Wrap attributes.
// - auto: Wrap attributes only when line length is exceeded.
// - force: Wrap each attribute except first.
// - force-aligned: Wrap each attribute except first and keep aligned.
// - force-expand-multiline: Wrap each attribute.
// - aligned-multiple: Wrap when line length is exceeded, align attributes vertically.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8394 次 |
| 最近记录: |