简体   繁体   中英

Regions/code collapse in Javascript in Visual Studio 2010

Is it possible to create code regions in JS files in Visual Studio 2010?

This method works in 2005, but I can't get working in 2010.

这是一个非常酷的VS2010扩展,用于Javascript和CSS概述http://jsoutlining.codeplex.com/

Microsoft now has an extension for VS2010 that provides this functionality:

JScript Editor Extensions

Advanced JavaScript Outlining for Visual Studio 11 is now available for VS2012 through the Extension Manger, or at the URL

http://visualstudiogallery.msdn.microsoft.com/4be701d8-af03-40a4-8cdc-d2add5cde46c?SRC=VSIDE

Visual Studio的JSEnhancements插件很好地解决了这个问题。

Another great Visual Studio 2012-Extension is Web Essentials 2012. There are a bunch of cool tools for even TypeScript, LESS and CoffeeScript.

http://vswebessentials.com/

即使安装了VS扩展,我也有一个独特的问题,即某些脚本块没有正确概述,后来发现它是因为脚本中使用的@ Url.Content标记,只需用简单的字符串url替换它,该概述有效。 ...如果它可以帮助某人,可以考虑分享

In VS 2015 you can just create a block around your "region" like this

{ //My little region
  function misc()...
  var x = '';
  //etc...
  ...
}

Then just collapse that block. Probably on all older versions of Visual Studio as well.

There's an interesting post here : http://blog.devarchive.net/2008/04/using-region-directive-with-javascript.html on how to do this using Macros in Visual Studio.

Hope that help.

Update I just realised that someone has already referenced this link in the comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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