Regions/code collapse in Javascript in Visual Studio 2010 - javascript

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.

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

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

The JSEnhancements plugin for Visual Studio addresses this nicely.

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

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.

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/

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

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.

Related

Why is the JavaScript Viewer not showing in Eclipse Editor Selection?

I am currently trying to code on Eclipse using JavaScript, but I am having a lot of troubles when tying to add JavaScript to Eclipse. I followed the instructions on this website (JavaScript Editor Plugin for Eclipse), and everything was going well until step 9 of the first part. JavaScript Viewer is not one of the offered options in Editor Selection. I am very confused as to what to do. Any help would be appreciated!
Thank you in advance :)
Version: Eclipse Oxygen on MacOS. Oxygen.3a Release (4.7.3a)
You could give the latest Eclipse IDE for JavaScript and Web Developers bundle a try.
It provides:
The essential tools for any JavaScript developer, including JavaScript, HTML, CSS, XML languages support, Git client, and Mylyn.
With this recent (2018) version of Eclipse, you should get a working JS-enabled IDE pretty fast as this is pre-bundled for the use-cases you are looking for:
JavaScript Development Tools
Eclipse XML Editors and Tools
[..]
Hope it helps.
FYI -- I ran into this problem with the latest version of eclipse [2020-06(4.16.0)]. It turns out they removed the Javascript editor from the install. See ref here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=564496

Javascript and VS2012 Intellisense

I am new to Visual Studio 2012 and Javscript coding. I have two questions i could not find answers on the web:
i have a webforms project and added some js-files to the sript-folder (http://raphaeljs.com/). Now i want to have Intellisense support for that js-library i added. Is that possible?
for what is the "_references.js" file in the scripts folder? I added all the js-library files to that file but it doesn't enable intellisense.
regards
I'm not sure about Visual Studio 2012, but in 2010, if you drag one JavaScript file onto another one it will add a /// <reference name="MyScript.js" /> line at the top of the second file. If the file being referenced is documented you will get quite useful intellisense, though it is still handy even if not for just being able to explore the surface of the API.
There is some good information in this question: IntelliSense for Ajax and JavaScript libraries in Visual Studio
To put it short, Visual Studio is terrible at intelli-sense for javascript. It is still light years behind other IDEs like IntelliJ & WebStorm.
A work around to slap it in line would be to use ReSharper which is a plugin but you need to pay for the license :(
Hope that helps.

Javascript Snippets in Visual Studio 2008

I'm sure this works in VS2010 but is there any way to get snippets to work in .JS files in Visual Studio 2008?
There's a comment from way back in 2007 in ScottGu's post about JS Intellisense that it might have happened, but I would like to know if it has been officially taken off the table.
I don't believe there is. If you look at more of Scott's blogs you will find this one.
http://weblogs.asp.net/scottgu/archive/2009/09/04/asp-net-html-javascript-snippet-support-vs-2010-and-net-4-0-series.aspx
He makes a comment of "Visual Studio has supported the concept of “snippets” for VB and C# in previous releases – but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well."

Javascript autocompletion plugin for VS. Net

I'm doing a lot of work in Javascript with Visual Studio .Net 2008. It would be nice to have some sort of plugin to do auto completion for Javascript (a bit like ctrl space and a list of options come up in Java/C# etc).
Is there such plugin/tool out there?
Thanks.
Yes.
Visual Studio 2008 Service Pack 1
I haven't tried it, but the VS2010 beta has even better Javascript Intellisense.

Any opensource Javascript editor/javascript eclipse plugin with code assist

I just happened to read jQuery Intellisense Updates from Microsoft and was wondering if there was any editor or eclipse plugin available which provides intellisense complete or code assist. Are there any?
I believe eclipse, with the Aptana plugin, has some JQuery support.
As mentionned here, intellisense is supported:
 5. Start coding.
As you type, notice that Code Assist is now active for the jQuery objects and functions that you use.
Press ctrl+space at any time to activate Code Assist.
Why not Visual Studio/Web Developer 2008 (or did I miss something)? The express edition is free.
You can use the standalone version of Aptana Studio, it's free and much lighter than the complete Eclipse.
Aptana provide Javascript code assist, but not intellisense.
True intellisense for Javascript currently provided only by three IDs:
NetBeans (open source)
IntelliJ Idea (proprietary web development)
MS Visual Studio (proprietary, free edition exist)
So the answer - NetBeans.
But, unfortunately none of these do this job well.

Categories