Resharper Plugins

http://resharper-plugins.jetbrains.com/packages?sortOrder=package-download-count&page=2&prerelease=False

Installed by me :
1. http://resharper-plugins.jetbrains.com/packages/ReSpeller/
2. http://resharper-plugins.jetbrains.com/packages/ReSharper.RazorExtensions/
3. http://etherealcode.com/respeller/
4. http://resharper-plugins.jetbrains.com/packages/AngularJS/
5. Respeller Free : https://resharper-plugins.jetbrains.com/packages/ReSpeller/

You can install directly into ReSharper 8.0 via the Extension Manager in the ReSharper menu. Since the package is currently pre-release for 8.0 (nightly builds might introduce breaking changes), make sure “Include prerelease” is selected in the dialog.

To install in ReSharper 7.1:
Advertisements

Cov and Contrav

Cov : if fruit is an (can replace ) apple then a array of fruit is and array of apple

assuming that A allows an implicit reference conversion to
B, a type X is covariant if X<A> allows a reference conversion to X<B>.

1. Array
2. IEnumerator<T>interface
3. IEnumerable<T> interface (This allows you to cast
IEnumerable<string> to IEnumerable<object>)

With both generic types and arrays, covariance (and contravariance)
is valid only for elements with reference conversions—not
boxing conversions. So, if you wrote a method that accepted a
parameter of type IPoppable<object>, you could call it with
IPoppable<string>, but not IPoppable<int>.

ContraV

A type is contravariant
when you can convert in the reverse direction—from X<B> to X<A>.

This
is supported with generic interfaces—when the generic type parameter only appears
in input positions, designated with the in modifier.

InV
1. Generic classes :using where
2. generic interfaces : support covariance for type parameters marked with
the out modifier

Real World Eg;
Our Stack<T> class can implement both IPushable<T> and IPop
pable<T>—despite T having opposing variance annotations in
the two interfaces! This works because you can exercise variance
only through an interface; therefore, you must commit to the
lens of either IPoppable or IPushable before performing a variant
conversion. This lens then restricts you to the operations that
are legal under the appropriate variance rules.
This also illustrates why it would usually make no sense for
classes (such as Stack<T>) to be variant: concrete implementations
typically require data to flow in both directions.

Visual Studio T4 Templates

Templates Designed using the Text Template Transformation Toolkit

BEST: http://www.slideshare.net/ChrisMelinn/introducing-t4-templates and http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx

https://www.nuget.org/packages?q=t4

http://www.olegsych.com/ : http://www.olegsych.com/2007/12/text-template-transformation-toolkit/

TOOL : http://www.olegsych.com/2012/12/t4-toolbox-for-visual-studio-2012/

BEST PLACE TO GET STARTED :

Follow these in order:

1. Install the Free Tangible T4 extension in VS…http://t4-editor.tangible-engineering.com/

2. https://www.youtube.com/watch?v=8OZ12Lp-Jjg&feature=player_embedded

3. http://t4-editor.tangible-engineering.com/How-Do-I-With-T4-Editor-Text-Templates.htm

4. http://www.olegsych.com/presentations/code-generation-with-t4-text-templates/introduction/

5. http://www.olegsych.com/presentations/code-generation-with-t4-text-templates/advanced-topics/

6. http://msdn.microsoft.com/en-us/library/dd820620.aspx

7. http://www.codeproject.com/Articles/269362/Using-T4-Templates-to-generate-custom-strongly-typ

Cool Enhancements in VS 2012 Update 2

paste json as classes in vs 2012 : http://blogs.msdn.com/b/webdev/archive/2012/12/18/paste-json-as-classes-in-asp-net-and-web-tools-2012-2-rc.aspx

then in JS file use the Model Binding to get intellisense on the JSON that will be returned at runtime using binding…

Eg.

1. JSON IS :

{
"link": "http://www.microsoft.com/Surface/en-US", /*Awesome*/
"virtual": "Virtual Keyboard",
"partial": " The magnesium panels are finished with partial vapor deposition",
"Price": 499.99,
"title": "Microsoft Surface",
"शीर्षक": "माइक्रोसॉफ्ट सरफेस",
"Like": true,
"cdDrive":null,
}

2. On pasting

namespace MvcApplication6.Models
{
[BindableType]  
public class Rootobject
{
public string link { get; set; }
public string _virtual { get; set; }
public string partial { get; set; }
public float Price { get; set; }
public string title { get; set; }
public string शीर्षक { get; set; }
public bool Like { get; set; }
public object cdDrive { get; set; }
}

3. Then in js file:
function doit(data) {
    /// <param name=”data” value=”MvcApplication6.Models.Rootobject”></param>  
    var foo = data.titl_virtual
}

this thing (pt no 3) is not yet finalized in VS …

Javascript intellisence enhanced using Nuget Packages

https://www.nuget.org/packages/VS2012-Javascript-Intellisense/1.0.712.2147

I remember having written about the jquery vsdoc that can  be downloaded form somewhere….blah blah…
But now its available as a nuget package so better use that as apart from the time saved in copy pasting, nuget allows for auto updation of packages also …

https://www.nuget.org/packages/jQuery-vsdoc

In Visual Studio 2012, Visual Studio will automatically find “.intellisense.js” file and use it like old vsdoc file without writing real JavaScript structure.

See: http://msdn.microsoft.com/en-us/library/vstudio/hh874692.aspx

OK, so i created a empty website and in that included the VS 2012 Javascript intellisense package first..

Then i wanted to compare the JQuery packages so i installed the most popular one first and it came with a .intellisense.js file but it wasn’t this good (http://www.asp.net/visual-studio/overview/2012/visual-studio-2012-javascript-editor), so then i excluded that and added the “jquery vsdoc” from nuget which was much better….

NOTE: Use both Ctrl + space and Ctrl + Shift + Space

THIS IS OFFICIAL: Resharper Ruins JS Intellisense in VS 2012. once i disabled it, i got intellisense like : (http://www.asp.net/visual-studio/overview/2012/visual-studio-2012-javascript-editor

http://gurustop.net/blog/2012/03/03/javascript-js-intellisense-auto_complete-in-visual-studio-11-beta-the-web-_references-js-file/

NOTE: http://stackoverflow.com/questions/14411014/resharper-intellisense-does-not-display-documentation

Finally Found the Best of Both Worlds in INTELLLISENSE…

So basically do  : ensure that Tools | Options -> Text Editor | JavaScript | General -> Auto list members  and Paramater Information is turned on.

I got the VS Intellisense and also Resharper too….
And in case u don’t like Resharper’s then press Esc to see the VS one behind it…
If u want pure VS only then on top of above, do :
If you prefer Visual Studio intellisense, please go to ReSharper | Options -> Environment | Intellisense | General, select Limited ReSharper intellisense and turn off JavaScript there.
In fact in Tools Options Editor All Lang make sure these are ENABLED :
1. Auto list members
2. Paramater Information
3. Word Wrap
4. Visual Glyphs
5. Line Nos

Shortcut Sharing Between Visual Studio and Resharper and Everyone Else

Having Infinite extensions installed is always a risk wrt shortcuts overriding each other and exploding your brain..

Resharper has removed the bindings to my 2 fav VS Commands :
Ctrl Q for Quick Launch and Ctrl E to search while adding a new file in project. Hence i went to tools options keyboard

Fixing this was surprisingly easy :  http://stackoverflow.com/questions/12957753/can-i-disable-or-change-a-single-resharper-shortcut

Suppose you want to change the binding of “Ctrl +Q”

1. Open Tools Options Environment Keyboard

2. Under “Press Shortcut Keys” Enter : Ctrl +Q

3. This will show you what all commands are currently bound to this shortcut

4. Then search for the commands in the “Show Commands containg window ” and REMOVE the asignment (for the context that you want).

5. Note that more than 1 command can bind to a shortcut depending on the context and so make sure you remove whatever you need

6. Then verify that no the binding is gone, by repeating step 2 above

7. Finally search for the new command that u want to bind the shortcut to and then enter shortcut and bind it in the context that u want to using ASSIGN

Simple

Remove Javascript intellisense from Visual Studio 2012

ha, how ironical…

Well the thing is that now that i use NuGet, it downloads 10s of JS files for no reason (i mean i need only 1 but it downloads all js files of the framework).

Then in the _references.js it adds ref to all these and as i have set in Tools-> Options -> JS-> intelli
that i want intell from files listed in _ref.js and in the C:\Program Files (x86)\Microsoft Visual Studio 11.0\javaScript\references folder (i think this is default setting)
so it throws all that on my face…

Hence remove everything from both these locations which u don’t want intellisence for

Even after removing js files from all these places intellisense was still perest hence i excluded the js files from project and then it was gone..then this is the source but where is the ref. ??

Then i searched for “jquery” in the entire project and found that its referenced in the auto generated classes like packages.config and BundleConfig.cs and then in Index.cshtml it is referenced as : @if (@User.Identity.IsAuthenticated)
{
    @section scripts {
        @Scripts.Render(“~/bundles/knockout”)
        @Scripts.Render(“~/bundles/jqueryval”)
        @Scripts.Render(“~/bundles/todo”)
    }
}

and also in Layout.cshtml :

    @Scripts.Render(“~/bundles/jquery”)
    @Scripts.Render(“~/bundles/jqueryui”)
    @Scripts.Render(“~/bundles/ajaxlogin”)

All this may be causing VS to give intellisense and it goes away only when these files are explicitly removed from the project….

whooo….this is bad..in fact the entire MVC 4 template is bad as it scaffolds so much stuff that its hard to maintain any control over stuff…..

found out that In Visual Studio 2012, Visual Studio will automatically find “.intellisense.js” file and use it like old vsdoc file without writing real JavaScript structure…and as the MVC Project scaffolding comes with the jquery.intellisense.js files etc. this may be the real reason for auto intellisense when i was simply includinf the files in the project….