ReSharper - Is there a disable command I can add to a file that will not allow reorder of type members? - resharper

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.

Related

prevent resharper from automatically fixing issues

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.

Enable Repair option in Programs and Featues/Add Remove Programs

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.

Chose a color for a particular method in VS2012

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.

Changing Drupal module template doesn't take effect

Okay, this could be a stupid question but I'm kind of new to this Drupal-stuff so I have to ask it anyway :)
I'm trying to implement the FBSS-module (FaceBook Style Status). It all works just fine. I was even able to change some colors and stuff in the CSS-file.
The thing is that I want to do some changes to the template, need to add and remove some stuff. I could hide stuff with CSS, but that sounds like a crappy solution.
I tried to edit:
/sites/all/modules/facebook_status/templates/facebook-status-item.tpl.php
But it has no effect what so ever. I tried to move it to my theme-folder. Same thing.
And yes, I've cleared the cache.
Update: Is there any way to find out if the module is actually using this template-file?
first, move it back to the module page - I bet this template is used by module.
secondly, if you change templates, it might require theme registry cache reset, so
go to /admin/build/themes.
You don't have to actually switch themes.
Do you have cache enabled? while developing, it's would be helpful to do 2 things:
1) disable cache
2) go to theme settings, and turn on "rebuild theme registry on every page load" or something that sounds like this.
and to be 100% sure, if you added new template you need to:
1) clear cache
2) go to admin/build/modules (that will rescan template files, etc)
3) go to admin/build/modules (that will rescan info about theme).
in the case of editing existing template, this also can help.
I've found, and I'm not sure if this solution would suit, that I apply a different theme and then re-apply my adjusted theme and all the changes propagate. No idea why but sometimes I don't see any changes until I do this.
Like I said, this may be isolated to myself, but it's worth a try to help you hit your deadline!

How to add custom code analysis in ReSharper

I'm new to ReSharper.
For those who uses Resharper, is there a way I can add custom code analysis rules?
For example I might have a rule say All private variables should start with letter "m". How can I add this to Resharper so if I violate this, it can shows as a warning or an error?
I know the question is old, but for all folks coming from google like me:
Resharper -> Options -> Code inspections -> Custom Patterns
There you can create your own rules for highlighting patterns or offering substitutions. This is for ReSharper 8. I'm not sure from which version this option is there.
Just to expand on what #AakashM notes above: this can be specified in ReSharper Options | Languages | (either Common or C# or whatever) | Naming Style.
If you click on Advanced Settings, and then double-click on one of the "entity descriptions", there is a far larger selection of possible entities (including events, namespaces etc) , together with access rights (private, protected, etc) and so on, for which you can define prefix, suffix and casing rules.
You can write your own plugins for ReSharper. Take a look at here:
http://stylecopforresharper.codeplex.com/
This is similar to what you're asking for. It might even do what you want. Not sure since I'm not a big StyleCop user.
Also take a look at the first in my series of blog posts coming on ReSharper plugins:
http://hadihariri.com/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined/

Resources