It's a wonderful addition in visual studio, I was using re-sharper 6.0 which has some nice Javascript re-factor feature, I definitely appreciate this kind of improvement and hope to see this extension with more and more feature in future versions.
For those people wanting a 'collapse all' feature. Simply press ctrl + m + a. This will collapse everything but if you've got 100's of JS functions like myself you'll find it useful!
Great extension. Thanks very much. Would love to see 'collapse to definitions' functionality as well as 'collapse all' functionality with the difference being that 'collapse to definitions' collapses function bodies only but not other blocks of code like 'if', 'else', 'for' or multi-line object initializers etc.
Like regular .Net languages, does this extension support custom collapsible code blocks, e.g.
//#region My block
Code here
//#endregion
or
//region My Block
Code here
//endregion
@rich: how does it work? I tried
//#region My block
Code here
//#endregion
and
//region My Block
Code here
//endregion
I didn't have success with either one of these ...
Thanks
I made this account just to answer this question as I've had the same problem. So in case anybody else runs into this, this is my solution.
Use javascript curly brackets to enclose your code and place a comment above to know what you are making collapsible.
//My region
{
//lines of code
//lines of code
//lines of code
}
these will collapse and don't appear to affect anything else. javascript just treats this a simple compound statement.
The last version of jQuery offered by that vsdoc generator (http://damianedwards.com/vsdoc) is 1.6.2, which is two major revisions out of date. I'd either find a new tool, incentivize that guy to update his tool, or just offer your own vsdoc file for the newest version of jQuery.
function $(tag) {
/// <summary>
/// return:ele
/// </summary>
/// <param name="tag" type="str">标签名</param>
return document.getElementById(tag);
}
/// <reference path="tools.js"/>
Reference tools.js, the $ commentary has Chinese; Write $ ,you will see garbled;
if tools.js is not utf-8,it`s wrong.Now I can not set 'utf-8' with tool.js
$(tag)
return:ele
???K???
Is it possible to configure formatting? What I really want - the main reason that I installed this extension - is the ability to pretty print JSON files. When working with large-ish (e.g. 500 line) JSON files, they are always returned to me on one *long* line, which is impossible to read. There are other JSON pretty printers out there, but I would like to be able to do this in VS.
As it stands, opening a JSON file (which I have typed to be represented the same as JavaScript) and selecting Edit > Advanced > Format Document just results in spaces being inserted after commas and some braces.
The comment auto-complete ///<summary></summary> functionality worked immediately after I installed but has since stopped working. Are there any known conflicts with out extensions or ReSharper?
I have the JScript Editor as well as Javascript Parser, and ReSharper installed.