Mr. Flibble
Mr. Flibble

Reputation: 27023

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.

Upvotes: 42

Views: 27396

Answers (8)

Wolf5
Wolf5

Reputation: 17140

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.

Upvotes: 0

rcp
rcp

Reputation: 311

Even though VS extensions installed, I had a unique problem of some of the script blocks not outlining properly, later found that its because of the @Url.Content tag used in the script, simply replaced it with simple string url, the outlining worked....thought of sharing if it helps someone

Upvotes: 0

kwrl
kwrl

Reputation: 653

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/

Upvotes: 0

Eric J.
Eric J.

Reputation: 150118

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

Upvotes: 1

BrianFinkel
BrianFinkel

Reputation: 2717

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

JScript Editor Extensions

Upvotes: 33

Joel Harris
Joel Harris

Reputation: 1966

The JSEnhancements plugin for Visual Studio addresses this nicely.

Upvotes: 1

Alex Yeung
Alex Yeung

Reputation: 2515

Here is a very cool VS2010 extension for Javascript and CSS outlining http://jsoutlining.codeplex.com/

Upvotes: 37

Jamie Dixon
Jamie Dixon

Reputation: 53991

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.

Upvotes: 0

Related Questions