Format html code in Visual Studio Code such that attributes are on separate lines?

前端 未结 4 1218
梦如初夏
梦如初夏 2020-12-25 10:22

There seems to be a lack of formatting settings for vscode. I want to be able to format html such that my html shows up as:

4条回答
  •  情书的邮戳
    2020-12-25 11:04

    VSCode added a way to do this now. You can edit your settings.json (ctrl+shift+p) and then add the following for the desired effect:

    "html.format.wrapAttributes": "force-aligned"
    

    --or--

    "html.format.wrapAttributes": "force"
    

    force-aligned will also add indents to align it with the attribute on the line where tag was opened.

    Visit this link for more details or updates.

提交回复
热议问题