简体   繁体   English

在VB.net网站中,VS2008始终对新文件使用空格缩进

[英]In VB.net websites, VS2008 ALWAYS uses space indentation for new files

So, I've changed my settings in Tools | 因此,我在“工具” |“工具”中更改了设置。 Options | 选项| Text Editor, for All Languages, Basic, and C#, to having Block indenting, and 'Keep tabs'. 文本编辑器,适用于所有语言,Basic C#,并具有块缩进和“保留选项卡”。 I've also tried this with Smart indenting too. 我也尝试过使用智能缩进。 Now, although once I start editing a file, its auto indentation is done with tabs, when I create a new web form in my ASP.net website, VS2008 insists on creating the initial code with space indentation. 现在,尽管一旦我开始编辑文件,它的自动缩进就可以通过选项卡完成,但是当我在ASP.net网站上创建新的Web表单时,VS2008 坚持使用空格缩进来创建初始代码。 So for example, I'll get an aspx.vb file for my new page like so: 因此,例如,我将为新页面获取一个aspx.vb文件,如下所示:

Partial Class Admin_Index
    Inherits System.Web.UI.Page

End Class

Note that the 'Inherits' line is SPACE-indented, even though I have the text editor settings set to keep tabs. 请注意, 即使我已将文本编辑器设置设置为保留制表符,“继承”行还是以空格开头。 Is there any way I can make the default created files indented with tabs, not spaces? 有什么方法可以使默认创建的文件以制表符而不是空格缩进? Or is VS just too stubborn? 还是VS太固执? :-) :-)

By the way, please don't just respond and say this is petty as I can quickly change that one line of indentation to using a tab. 顺便说一句,请不要只是回答并说这是小菜一碟,因为我可以快速将一行缩进更改为使用制表符。 I know this, but I have a software team that find it irritating as we have an SVN hook that prevents checkins if there's any space-indentation. 我知道这一点,但是我有一个软件团队发现它很烦人,因为我们有一个SVN挂钩,可以防止签入(如果有空格)。 It would be very useful if any newly-created files have tab indentation from the start, rather than us having to change it every time. 如果任何新创建的文件从一开始就具有制表符缩进,这将非常有用,而不是我们每次都必须更改它。

If none of the Visual Studio settings work, you could change the template files to have tabs in them. 如果所有Visual Studio设置都不起作用,则可以更改模板文件以在其中包含选项卡。 They're found in C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\ItemTemplates\\VisualBasic\\ , in zip files. 它们位于zip文件的C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\ItemTemplates\\VisualBasic\\中。

Also, you can quickly re-format the currently opened file by pressing Ctrl+K , Ctrl+D (Edit -> Advanced -> Format Document). 另外,您可以通过按Ctrl+KCtrl+D (编辑->高级->格式化文档)快速重新格式化当前打开的文件。

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

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