简体   繁体   English

在Visual Studio中编辑.aspx文件时令人讨厌的缩进

[英]annoying indenting in Visual Studio when editing .aspx files

When I am editing VB code inside a .aspx file in Visual Studio 2010, my code is automatically indented in a bizarre way. 当我在Visual Studio 2010中编辑.aspx文件内的VB代码时,我的代码会以一种奇怪的方式自动缩进。 I have searched through the options and can't find anything that fixes this. 我已经搜索了所有选项,但找不到任何可解决此问题的方法。 [I thought unchecking Pretty listing (reformatting) of code in Text Editor -> Basic -> VB Specific would for sure do the trick but it didn't] [我以为在文本编辑器->基本-> VB特定中取消选中代码的漂亮清单(重新格式化)肯定可以解决问题,但事实并非如此]

Example -- here is the beginning of a .aspx page: 示例-这是.aspx页的开头:

<%@ Page EnableSessionState="True" Language="VB" Strict="true" %>
<script language="VB" runat="Server">
Dim foo As String

If I go to the end of the "Dim foo" line and hit it will indent. 如果我转到“ Dim foo”行的末尾并单击它将缩进。 If I fix the indentation, the next line will do the same thing. 如果我修复了缩进,那么下一行将执行相同的操作。

In my IDE I often use "CTRL K + CTRL D" and VS formats my code really neat. 在我的IDE中,我经常使用“ CTRL K + CTRL D”,而VS格式使我的代码非常整洁。 Maybe that might help. 也许有帮助。

In Visual Studio, under the Tools --> Options menu item you will find Text Editor --> Basic --> Tabs . 在Visual Studio中的“ 工具”->“选项”菜单项下,您将找到“ 文本编辑器”->“基本”->“选项卡” The setting under this section will allow you to control the indenting however you would like to. 此部分下的设置将使您可以控制缩进,但是您希望这样做。

Enjoy! 请享用!

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

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