Tuesday, July 16, 2013

Snippet to Create “C# Like” Collapsible Regions in VS2012 Javascript Files

Ever wanted to create a collapsible region within Javascript? If you have the Web Essentials Extension for VS 2012 you already have that feature:
image
But, the one thing that they are missing in the Web Essentials Extension is a snippet to allow you to automatically insert the region syntax.  Just save this text to “C:\Users\$UserName$\Documents\Visual Studio 2012\Code Snippets\JavaScript\My Code Snippets\regions.snippet” on your local computer, and viola!
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <Header>
    <Title>region</Title>
    <Author>Daryl LaBar</Author>
    <Shortcut>region</Shortcut>
    <Description>Code snippet for region in javascript Using Web Essentials 2012</Description>
    <SnippetTypes>
      <SnippetType>Expansion</SnippetType>
      <SnippetType>SurroundsWith</SnippetType>
    </SnippetTypes>
  </Header>
  <Snippet>
    <Declarations>
      <Literal>
        <ID>name</ID>
        <ToolTip>Region name</ToolTip>
        <Default>MyRegion</Default>
      </Literal>
    </Declarations>
    <Code Language="JavaScript">
      <![CDATA[//#region $name$
 
 $selected$$end$
 
//#endregion $name$]]>
    </Code>
  </Snippet>
</CodeSnippet>

3 comments:

Jagna Co Kalani said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from .Net Training in Chennai. or learn thru ASP.NET Essential Training Online

sasitamil said...

This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb.
This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here 


Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

yashnit said...

I Regreat For Sharing The information The InFormation shared Is Very Valuable Please Keep Updating Us Time Just Went On Reading The Article Python Online Training AWS Online Training Hadoop Online Training Data Science Online Training