views:

31

answers:

3

I have ReSharper 5.0 for C# running on VS 2008 SP1. Most key combinations like (Ctrl+R, Ctrl+R) for renaming an identifier or (Ctrl+Shift+T) for going to a file work.

I thought I would try some of the other refactorings like adding a parameter to a method, but I get the following error, when I put the cursor over a private method.

The key combinations (Ctrl+R, Ctrl+P) is bound to command (ReSharper_IntroParameter) which is not currently available

I can easily rename this same method with (Ctrl+R, Ctrl+R). Is it me, or ReSharper that's failing here?

+1  A: 

when I put the cursor over a private method

The Introduce Parameter refactoring is only available when you over an identifier or value within the body of the method, that you want to make into a parameter. It sounds like you want the Change Signature refactoring, which is available via Ctrl+R Ctrl+S whenever the insertion point is on the method name.

You can see (some of) what is in context with Ctrl+Shift+R, which is the shortcut for ReSharper | Refactor | Refactor this...

AakashM
This is all useful thanks, but it didn't work within the body of the method. Promoting a local to a parameter would be nice, but apparently not available.
Blanthor
A: 

Based on the error message the key mapping is working just fine. Visual Studio is finding and attempting to execute the command. The command itself is reporting itself as unavaliable.

This is likely an indication that the "IntroParameter" command is simply not available in the contxt you are attempting to use it in.

JaredPar
You're correct about the context.
Blanthor
+1  A: 

I think you might be confusing "Introduce Parameter" with the concept of "adding a parameter to a method". I do not believe that ReSharper has a shortcut to simply add a parameter to a method. "Introduce Parameter" is intended for you to select an expression and apply that shortcut, whereupon ReSharper will add a parameter to your current method based on that expression. Meaning whatever expression you highlighted will be moved to the caller of the method and passed as an argument for that new parameter.

Kirk Woll
I tried this on one of my query expressions and it does seem to work.
Blanthor