Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper - Disable 'help' when using "prop" shortcut in C#

I'm getting quite annoyed with a feature of Resharper that I just cannot find how to disable independently.

With Resharper turned off, whenever I type prop in VS2015 and press TAB, I get the following auto-generated code:

public int MyProperty { get; set; }

and I'm then able to switch between int and MyProperty repeatedly by pressing TAB again. I'm also able to use autocomplete to fill in the variable type as I type.

For example, lets say I wanted to create a property called "test" of type "string", I would do the following:

  1. type prop
  2. press TAB to generate the property code template
  3. type stri
  4. press TAB to autocomplete the variable type with string
  5. press TAB to move to the variable name placeholder
  6. type test
  7. press Return to finish

perfect.

However, with Resharper enabled, whilst steps 1,2 and 3 still work, it all goes to pot after that!

If I press TAB to try and autocomplete the variable type, the cursor simply moves over to the variable name, leaving the variable type as stri.

If I then press TAB (or even SHIFT+TAB) again to try and get back to it, it simply finishes the line.


To make things clearer, I've included two gifs demonstrating my problem.

This first one shows what happens with Resharper disabled: enter image description here

Whilst this one illustrates the frustration I'm currently experiencing with Resharper enabled: enter image description here

like image 553
Sk93 Avatar asked Oct 08 '15 08:10

Sk93


2 Answers

I understand this is an old(er) question and already has an answer; however, I wanted to provide a solution for future SO readers that would allow one to continue using Visual Studio's IntelliSense as opposed to Resharper's.

I had the same issue as the OP (original poster) and found the issue to be caused by a conflict with Resharper's Live Templates. With Resharper enabled, the resolution of prop after Tab + Tab, resolves Resharper's prop Live Template and not Visual Studio's prop snippet. You might have notice that in OP's 2nd screen cap (the one with Resharper enabled) that the resolution of prop has a datatype shown as TYPE instead of int. This is because Resharper's Live Template has set this parameter name to TYPE, while Visual Studio's snippet has the same parameter set to int by default. This is what lead me to look at Resharper's Live Templates for a resolution; lo and behold turning off the prop Live Template fixes the issue.

Go to Resharper's Template Explorer (Resharper -> Tools -> Templates Explorer) you will see there is a Live Template named prop. Simply clear the check box for the prop Live Template and Visual Studio's prop snippet resolution, and datatype resolution for that matter, will start working again.

enter image description here

enter image description here

like image 56
Brandon Manchester Avatar answered Nov 14 '22 14:11

Brandon Manchester


It looks like you have an intellisense setting conflict. Re-Enable Resharper and then change this setting:

Resharper->Options->IntelliSense->General

Change the selection from "Visual Studio" to "Resharper", hit Save and the desired behaviour should be yours.

enter image description here

like image 34
Paul Avatar answered Nov 14 '22 16:11

Paul