开发者

How can I create regions in a classic asp file which will be collapsible when using Visual Studio 2010

开发者 https://www.devze.com 2023-04-10 21:17 出处:网络
When working on a classic asp file in Visual Studio 2010, html is pickup up as being collapsible. I\'d like to be able开发者_C百科 my own regions within normal asp.

When working on a classic asp file in Visual Studio 2010, html is pickup up as being collapsible. I'd like to be able开发者_C百科 my own regions within normal asp.

How can I add such "regions" ?


You can just select a section of code and use the shortcut CTRL + M, CTRL + H to create a collapsible region. Works fine with classic asp.

See related shortcuts here: msdn


There's no built-in support for this, but you can write your own Macro command which will achieve the same result.

Indeed, this has already been done. See Region Tools For Visual Studio and also a tutorial based upon that work for providing region support in JavaScript (written for Visual Studio 2008, although easily tweaked for Visual Studio 2010).

The macro essentially looks for specifically formatted comment lines then uses the programmability of the IDE's editor window to provide a "collapsed" area between the two specially formatted comment blocks.

In the JavaScript example, there are two hard-coded constants that represent the specially formatted comment blocks that represent the start and end of regions:

Const REGION_START As String = "//#region"
Const REGION_END As String = "//#endregion"

The // at the start signifies the start of a comment within JavaScript, but this won't work in "classic ASP", so you can change this to the relevant comment signifier for VBScript, for example something like:

Const REGION_START As String = "<!--//#region-->"
Const REGION_END As String = "<!--//#endregion-->"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号