简体   繁体   English

VS Code 关闭自动格式化程序的 wrapAttributes

[英]VS Code Turn off wrapAttributes for auto formatter

I have the following html codes:我有以下 html 代码:

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css"
    integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">

Whenever I use VS code's auto formatter by pressing shift+Alt+f", it just wraps the integrity attribute to the next line. I would like to keep everything on one line. I did some research, and found out the setting that control it is html.format.wrapAttributes`, but according to the documentation, the only four settings are:每当我通过按shift+Alt+f", it just wraps the使用 VS 代码的自动格式化程序时shift+Alt+f", it just wraps the完整性attribute to the next line. I would like to keep everything on one line. I did some research, and found out the setting that control it is shift+Alt+f", it just wraps the attribute to the next line. I would like to keep everything on one line. I did some research, and found out the setting that control it is html.format.wrapAttributes`,但根据文档,只有四个设置是:

auto: Wrap when the line length is exceeded
force: Wrap all attributes, except first
force-aligned: Wrap all attributes, except first, and align attributes
force-expand-multiline: Wrap all attributes

There is no setting to turn it off.没有设置可以关闭它。 I have tried to set it up as "html.format.wrapAttributes": false and "html.format.wrapAttributes": "" .我试图将它设置为"html.format.wrapAttributes": false"html.format.wrapAttributes": "" They do not help.他们没有帮助。

I am wondering how to setup VS code such that every time I use VS code HTML auto formatter, it does not wrap integrity attribute to another line anymore?我想知道如何设置 VS 代码,以便每次使用 VS 代码 HTML 自动格式化程序时,它不再将integrity属性包装到另一行?

You should be able to choose preserve or preserve-aligned .您应该能够选择preservepreserve-aligned

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM