Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is ReSharper's cleanup code option unavailable?

When using ReSharper in Visual Studio, I often cannot run the "code cleanup" option, as it is grayed out in the menu. I have also tried using the hotkey but I get the error message: The key combination (Ctrl+E, C) is bound to command (ReSharper_CleanupCode) which is not currently available.

I've done a lot of research about it online and found that often the reason this option is not allowed is that the file I am working on has not been added to the solution explorer.

If I add the JavaScript file I'm working on to the solution explorer, it then allows me to code cleanup, but this is EXTREMELY inconvenient for me; I open many files in my work and I do not want to make a new project/solution, then manually add the file each time to use this ReSharper feature. (also by adding files to the solution explorer, the files stop saving and I have to manually copy/paste the code from them into the original document when I'm done working with them.)

Is there a setting in ReSharper that I can change to allow me to code cleanup my currently selected file under all circumstances without needing to add it to the solution manual first?

If not, is there a way to configure or utilize Visual Studio 2015 in such a way that allows me to easily add JavaScript/CSS/HTML files to Visual Studio and also to the solution explorer when I don't have a solution/project already created and loaded? (and also actually save the file when I'm done working on it to where I dragged/dropped it from, rather than embedded in a solution file (.sln)?) (Currently, Visual Studio DOES save files with CTRL + S, but ONLY if it has not been added to a solution/project. It's currently how I'm editing all of my files.)

like image 922
Alan Nelson Avatar asked Nov 15 '15 03:11

Alan Nelson


1 Answers

I realize this is quite old, but I encountered this in VS2017 with Resharper 2018.1.2. The only "workaround" I found was to Suspend Resharper, then Resume it.

Tools -> Options -> Resharper Ultimate -> General -> Suspend Now

Then in the same menu

Resume Now.

like image 94
AaronR Avatar answered Oct 18 '22 14:10

AaronR