在Visual Studio Code中禁用HTML属性对齐

Jos*_*man 6 visual-studio-code vscode-settings

当我格式化HTML文件时,VS Code正在堆叠元素属性。有什么办法可以禁用此功能?

小智 7

这对我有用。在“Settings.json”文件中添加以下行

"prettier.printWidth": 300
Run Code Online (Sandbox Code Playgroud)


Gam*_*a11 5

默认设置是:

"html.format.wrapAttributes": "auto"
Run Code Online (Sandbox Code Playgroud)

随着"auto"意思是:

仅在超过行长时换行属性。

线长在其他设置中定义,默认为120

// Maximum amount of characters per line (0 = disable).
"html.format.wrapLineLength": 120
Run Code Online (Sandbox Code Playgroud)

因此,将设置"html.format.wrapLineLength"0应该可以为您提供所需的行为。

  • 这不能回答问题,因为它通常禁用包装而不是属性的堆叠 (3认同)