views:

236

answers:

7

I'm attempting to use the Ctrl+R, Ctrl+R command within Visual Studio 2008 to rename a variable. I get an error message at the bottom saying that

"The key combination (Ctrl+R, Ctrl+R) is bound to command (&Rename...) which is not currently available."

I am not running it or anything I can think of which might prohibit modifications of the file and the F2 command allows a rename to happen. Anyone know how to fix this?

EDIT: I do have Resharper installed but was previously able to do this with the same setup, I recently migrated computers.

A: 

Are you doing this while you are debugging code?

Raj More
I am not doing this while debugging.
mwright
A: 

This is usually the shortcut used be Resharper. Is there any chance Resharper is not running?

Alternatively, you can change the name, hit Ctrl+. and then use rename

Sander Rijken
+1  A: 

Do you have installed latest Service pack for Visual Studio? and the Latest version of Resharper?

MaK
Visual Studio is Version 3.5 SP1 and Resharper is 4.5, I believe these are both up to date.
mwright
that's OK.Do you try reinstalling Resharper. Something could be corrupt.or can you see your options in. Tools | Options in the main menu Environment | Keyboard in the lefthand navigation view
MaK
+1  A: 

resharper has multiple default shortcut bindings that is chosen the first time you start visual studio after instalation. My guess is you picked a different one this time.

Andrey
This was helpful in fixing the problem.
mwright
@mwright - be sure to mark a solution if it helped you solve the issue.
CrimsonX
@CrimsonX - while helpful it wasn't actually the solution, I guess what's protocol on that? You mark it as solution and then update your post to include the steps for the solution or create your own answer?
mwright
@mwright. A good question. If I were in your situation, and found a detailed answer with the help of myself, I'd answer my own question, mark it as the answer, and thank (and upvote) people that helped you find the solution. Its a judgment call...
CrimsonX
A: 

You get this behaviour in Visual Studio (without R# installed) if the editor window does not have focus when you issue the shortcut. I've just tried it with R# installed and it does the same thing.

Give the editor focus (ie. by clicking in it) and try again.

adrianbanks
Tried this, same results.
mwright
A: 

This happened to me once. I had to reinstall Resharper (repair from Add/Remove programs probably) to get it to work. But that was with VS2005 though.

Bala R
+2  A: 

I was able to fix this by doing the following:

  1. Go to Resharper -> Options menu commmand
  2. Select Environment -> General
  3. Select the Visual Studio option under "Restore ReSharper keyboard shortcuts"
  4. Click Apply or OK
  5. Use Ctrl+R, Ctrl+R to rename a variable
  6. In dialog box that pops up select ReSharper options

This will cause Ctrl+R, Ctrl+R to do a rename. This, however, made F2 no longer able to preform a rename. I was able to fix this by doing the following:

  1. Go to ReSharper -> Options menu command
  2. Select Environment -> General
  3. Select the ReSharper 2.x or IntelliJ IDEA under "Restore ReSharper keyboard shortcuts"
  4. Click Apply or OK

This allows both F2 and Ctrl+R, Ctrl+R commands to work for renaming a variable.

This seems to be specific to ReSharper being installed with Visual Studio, I don't know what the solution would be to fix this if ReSharper weren't installed.

mwright