Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper: Rename namespace not available?

I'm trying to rename a namespace. For some reason, ReSharper isn't giving me the option to do so. I right click on it and choose Refactor, but everything except "Convert" is greyed out. I try the key combination CTRL R + R, and it says the command is unavailable. What am I doing wrong?

Here is documentation suggesting that what I am trying to do should work:

http://www.jetbrains.com/resharper/documentation/help20/Refactoring/renaming.html#renameNamespace

I'm using Visual Studio 2008 with R# 4.5

like image 421
Nick Heiner Avatar asked Apr 12 '10 16:04

Nick Heiner


2 Answers

I have come across this before and the answer is very subtle. Do not select (eg by double clicking) the entire method name(or namespace if renaming a namespace). Instead, ensure the method name is deselected and place the caret over the method name. eg

enter image description here

NOT this

enter image description here

When you select the Convert menu the items should now be available for methods, and 'Rename' will become available if you had the caret over a namespace. In my mind this should be changed, it is not obvious.

like image 123
wal Avatar answered Oct 02 '22 16:10

wal


Apparently, the way to do this now is via ReSharper => Refactor => Adjust Namespaces menu or open the Class View, right click on the namespace you wanted to rename and again select Refactor => Adjust Namespaces.

See also: Fastest way to update namespaces with ReSharper?

like image 38
Michael Teper Avatar answered Oct 02 '22 17:10

Michael Teper