简体   繁体   中英

prettier - disable auto closing of html tags

How to disable/avoid prettier to auto-close an HTML tag on formating? I tried "html.autoClosingTags": false in vs code settings.json, but It does not work.

Before formatting:

<body>
    <h1>home page</h1>

After formatting:

<body>
    <h1>home page</h1>
</body>

Inside your JSX the code you need:

{
  "javascript.autoClosingTags": false,
  "typescript.autoClosingTags": false
}

In order for your tags not to automatically close. You can also adjust this in your preferences per version # 16.11.

Go to File > Preferences > Settings, search for html. autoClosingTags and set it to false . This will make it so when you type , it won't insert automatically, but if you start typing </ , it won't close the tag automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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