Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor September 29, 2023 Post a Comment If you'd like to see this implemented in the next version of VS, please vote for it here. Suppose the following horizontally lengthy HTML declaration: Solution 1: Well, I found a trick at the ASP.NET Forums:Positioning each attribute on a separate lineIt's not like the XAML feature described in my question but it works.In Options/Text Editor/HTML/Format you can check "Wrap tags when exceeding specific length" and set the length to 1. That will cause the formatter to wrap like crazy.Another option is:Go to TOOLS => Options... => Text Editor => XML => Formatting => Align attributes each on a separate line.Close the .cshtml file. Right click it in Solution Explorer and select Open With... then select XML (text) Editor. Select all content and do Ctrl + K then Ctrl + F.* This second option is tedious! :( Solution 2: If you feel brave, you can write an editor extension that does this for you. Take a look at the align extension that Noah wrote a while ago for ideas: https://github.com/NoahRic/AlignAssignmentsSolution 3: This has been implemented in the new HTML editor in Visual Studio 2013 Preview, which has been released. This is a feature of the new editor only, which works for html and cshtml files, but not for aspx/ascx files. If you hit [return] after each value, the attributes will stack up under the first attribute definition. Format Document will not undo these changes anymore.Solution 4: Copy the html to the xml editor let it format it for you, then save it back to the html fileSolution 5: you can Find/Replace < with /n< + don't forget to click Use Regular Expressions setting Share Post a Comment for "Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor"
Post a Comment for "Break Line On Each Tag Attribute And Keep Them Aligned In Visual Studio Html Code Editor"