Configuring the formatting of <% %> blocks in Visual Studio editor

后端 未结 4 525
-上瘾入骨i
-上瘾入骨i 2021-02-05 20:28

In Visual Studio 2010, under Tools -> Options -> Text Editor -> HTML -> Formatting -> Tag Specific Options, there are options for configuring how the editor auto formats differe

4条回答
  •  不要未来只要你来
    2021-02-05 21:05

    You were looking in the right area:

    Tools -> Options -> Text Editor -> HTML -> Formatting -> Tag Specific Options.

    However, you need to set the option in "Client tag supports contents", under Default Settings, for Line breaks to "None". Visual Studio is looking at this setting rather than the setting for the

    tag.

    I don't believe this will give you the spacing inside the <% %> tag that you want, but it will fix those pernicious extra line breaks.

    [EDIT] I had initially said to set the option for "Server tag supports contents", but I think it's actually "Client tag supports contents" (I changed this above). You can also set the "Line breaks" setting to "Before and after" instead of to "None" if that better gives you what you are looking for. You may also need to set Line breaks for "Client tag does not support contents" to "None".

提交回复
热议问题