I noticed that Resharper automatically applies fixes (e.g. removing unnecessary namespace prefixes) in methods that I am not working on within the file I'm working on. How do I turn this off? (I only want to fix things if I take specific action).
After reading your question, I'm not sure whether it is about disabling automatic fixes, or just make them more local.
What you're talking about, is called Code Cleanup. You can disable parts of that in the ReSharper options, including the "Optimize Using directives", which you were talking about.
If you just want to cleanup/format a part of a file, you have the option to first select the method/code part, and then hit the shortcut to cleanup. Then, all modifications will just apply to the selected area, not the file.
Related
I have been using the above tool and Excel 2013 with mixed success. The good news is that it eventually works, the bad being that when it doesn't the following horrible things happen when modifications inside of the Editor are made:
modules with callback code revert to their state before the callbacks were added (ie, the code is lost!). This seems to happen even when there are no errors. This is frustrating!
custom tabs and context menus just don't show up if there is a conflict. For example specifying a callback to getLabel in xaml when there is also a label attribute specified. Of course this is my bad but it wouldn't hurt if the tool would catch this for me.
Question
Is the Editor the state of the art for customizing the ribbon and adding context menus. I realize the price is right but would gladly pay for a smoother and more reliable dev experience
The CustomUI editor doesn't affect modules in the workbook - but if you do make changes to the workbook while it's opened in the UI editor, then yes you may lose changes.
Also, you can set Excel to warn you of UI errors which will at least assist you in working out why your tabs/controls aren't appearing.
The problem Rory described (losing your changes) has bitten me many times, even when I am fully aware of why it happens (I may just forget I made changes externally).
Due to that and many other limitations I saw in the Custom UI Editor, I decided to create my own editor based on the original:
https://github.com/fernandreu/office-ribbonx-editor
For this particular issue, what I did was to implement a "reload on save" feature, which reloads the entire contents of an Office file (spreadsheets, VBA modules, etc.) right before the custom UI files are saved, hence preventing any accidental loss. I hope you might find this useful to prevent any future frustration!
Disclaimer: I am (obviously) the author of the tool above
I've searched all over for a solution and have not been able to get them to work.
My company's product used to have the Repair option when selecting the product in the Programs and Features dialog. You could also right click on the product and select Repair there as well. Just before I inherited the installer projects, this Repair option disappeared. I looked around to see if anything was disabling this option and couldn't find anything.
In InstallShield DisableRepair is set to No. There also is no registry key set in the Uninstall section for the product for NoRepair when the product is installed. By default, I believe I should be seeing the Repair option and don't understand why it's not there. I've tried messing with ARPNOREPAIR in custom actions, all to no avail. I even created a registry key for NoRepair with both 0 and 1 for DWORD values to see if it actually would work and it did not. I'd like to say that there is some code somewhere that is disabling it, but I've checked everywhere and even talked to the previous installer coworker and he doesn't know of anything removing that option.
Does anyone have information on this?
After lots of digging around and testing I have found out some interesting things and a solution to my issue. It turns out that there was a C# custom action that was creating a separate registry entry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. Also, ARPSYSTEMCOMPONENT was being set to 1 in InstallShield which was disabling the original entry from showing in Programs and Features, while the new entry was set to show. Apparently NoModify and NoRemove work with the new entry, but not NoRepair(no idea why this is). My solution was to go back to the original entry and modify the keys that I was adding in the custom action.
Pretty dumb question I know,
I want to know if there is a way to assign a particular color to a method of my choice in .cs file.
So that i donot even accidently go and write or change anything there.
No, Visual Studio does not support this behavior natively (though someone could write an extension that did it).
Some ideas, though...
My first suggestion is to use version control so that any changes you make can be reviewed and reverted.
My second is, in C# you could use a partial class to keep all the code that should never change in one file and the code you can change in another file. You could even go further and set the readonly flag on the file you never want to change (though check how this affects your source control system).
But use version control either way.
Much like
// ReSharper disable ConvertToAutoProperty
I would like to know what, if existing, I can add to particular files (and only particular files) so that fields are not sorted on code cleanup.
For more information:
I know there are settings one can set in R# itself. This needs to work even where I don't control settings (like on other people's computers)
I know I can make a setting to disable sorting for particular types in TypeMembersLayout. This also will not work due to the same reason.
I only want this to happen on files I care that it doesn't happen with, not a global setting.
I've been using Resharper for years, and can say with confidence this option doesn't exist. Good idea though..
Maybe Generated Code options can help you. But I didn't try it.
Go to ReSharper->Options->Code Inspection->Generated Code and add your files.
I think ReSharper leaves such files untouched.
Has anyone used JustCode from Telerik lately? This question has been asked about two years ago, but I'm sure the issues must have been resolved by now. Especially referring to running it side by side with ReSharper.
I have been using Resharper for a while now. I decided to try JustCode to see how it behave.
After a week of using JustCode, I am uninstalling it and returning to Resharper.
What I like about JustCode:
A single window indicating all warnings/errors in entire solution.
Performance seemed to be a bit better than Resharper.
Refactoring is easier to get to.
Projects can be excluded, or type of file
Language can be excluded (such as XAML)
What I did not like about JustCode:
Sometimes the underline used to open the option for fixing or refactoring is frustratingly hard to click since VS also puts an underline at the same spot (and it is the context menu of the latter that pops up).
Cannot change an hint to be a warning instead.
Saw some minor bugs
JustCode was giving hundreds of false positive warnings in the XAML code (luckily I could turn the inspection of XAML off)
What I was missing from Resharper:
Warnings about method parameter missing/mismatch from the documentation
Hints to transform an expression into a Linq expression.
When writing an opening bracket, resharper automatically adds the closing one and puts you on an empty line in between the two.
When completing a method, Resharper adds the first parentheses. It also adds the last one if that method is parameterless.
I am sure there is a bunch of other stuff that I can't remember now
You can install both Resharper and JustCode alongside. I first suspended Resharper before installing JustCode and used JustCode fine. When I resumed Resharper and restarted VS, both were running together without error.
Together, Resharper was finding more than JustCode.
For example, JustCode did not give a warning for the following: "Value assigned is not used in any execution path."
It even missed an error: "Cannot convert type 'int' to 'bool'." The expression was:
if ((bool)CanDoIt) // Here CanDoIt is a property of type int.
{
...
}
All in all, the tool is not bad. I recommend it over not having any. But if you have the choice between Resharper and JustCode, go with Resharper... for the moment; JustCode is still young.
You can change the size of JustCode's smart tag or turn off Visual Studio's smart tag in JustCode's options menu. I prefer to access VS's smart tag by using ctrl+., so it hasn't been an issue for me.