I am using ReSharper 7.
I have set up my Formatting style, and I want Resharper to generate warnings (amber light in vs) when this style is not adhered to. For example if we do not follow K&R method bracing style I want to see the amber light.
Is this possible? How would I do this?
You can generate warnings for invalid style by installing StyleCop for Resharper.
Whether StyleCop's default settings are suitable for you is another question.
Related
I've used Php for quiet some time and really liked/got used to the feature to collapse code blocks surrounded by curly brackets, with a click on the little plus/minus icons next to the linenumbers.
PhpStorm
Now I'm doing a Java project with IntelliJ and would like to have this feature too. It works for certain cases like classes, functions and custom regions, but not for if/else, switch statements.
IntelliJ without icons
Already tried changing the Folding options, but without success. I know I can achieve the same result by some keyboard-shortcut, but I would like to have those little plus/minus icons next to the linenumbers.
After using the shortcut the little icons appear though.
IntelliJ with icons
Am I missing some options or is there a plugin that can do that?
Currently it's shown for classes, functions, and custom regions. Please vote for this request to change default behavior: https://youtrack.jetbrains.com/issue/IDEA-144819
It is not clear from your question if you tried to enable "code folding outline" feature in the settings, which is under Editor -> General -> Code Folding -> Show code folding outline which does what you want basically.
I'm trying to suppress highlights in ReSharper using ReSharper Platform (not ReSharper product).
Some context:
Exceptional is a ReSharper plugin, that highlights undocumented exceptions among other useful things. In some cases, these highlights are safe to be "suppressed".
Currently, suppressing comments aren't working: https://github.com/CSharpAnalyzers/ExceptionalReSharper/issues/37
I can suppress it by looking for the suppression comments (e.g.: // ReSharper disable once ExceptionNotDocumented) and simply not adding the highlight to the DefaultHighlightingConsumer, however, I'm not convinced that the platform doesn't have a simpler way to do this.
Is there a simple way to make ReSharper consider these suppressing comments?
Thanks in advance.
With help from #citizenmatt I've finally come to the solution.
A change in the API (starting from 2016.1) has introduced a new HighlightConsumer implementation named FilteringHighlightConsumer. Using this implementation will consider all suppressing comments.
Here is the link to Matt's answer: https://resharper-support.jetbrains.com/hc/en-us/community/posts/206559159-10-1-EAP-and-RegisterConfigurableSeverity?flash_digest=1939ba6f66e30d494edb8f0d6a902eab4b198342
is it possible to only enable resharper for javascript and css files? I don't want it inspecting my c# files as it's driving me nuts with it's styling and and at times somewhat controversial recommendations. I haven't got time to set each individual setting, I'm just looking for a "don't inspect c# files" check box, if there isn't one I think my resharper trial will be officially over.
If you really want to disable ReSharper for C#, try going to ReSharper | Options -> Code Inspection | Settings -> Edit Items to Skip and add a file mask to skip *.cs.
But better way would be to disable those ReSharper warnings that you don't like. To do this, click Alt-Enter on the suggestion that you don't like, go to Options submenu, select Configure inspection severity and then Do not show. This is for ReSharper 8.0, in 7.1 it should be pretty similar.
I'm trying to find a list of all the default formatting and rules that Resharper enforces.
Unfortunately, I'm not having any luck.
We use the tool, but want to provide a document of standards to new hires so they can view the standards prior to coding.
Under the ReSharper menu, then Options, you'll find the current rules and conventions ReSharper is using for this solution. Of particular importance are:
Code Inspection->Inspection Severity: Shows the severity of things that ReSharper detects in code. The more things that are warnings or errors, the more closely you will have to conform code to ReSharper's conventions in order to get the file to "go green", or even to compile. The hierarchy is:
Do Not Show - self-explanatory, ignores the inspection
Hint - Does not show on sidebar, shows as dotted line under code in question. Good example: using "var" when the line of code doesn't otherwise explicitly specify the type being assigned.
Suggestion - Shows on sidebar as green tick, code in question has green underline. Good examples: use of "var" when type is explicitly defined in the assignment, member visibility.
Warning - Shows on sidebar as yellow tick, code in question underlined blue, or text is faded color. Naming convention violations, redundant keywords or qualifiers, unused code members.
Error - Red sidebar tick, code in question either red text or underlined red. By default, nothing that wouldn't cause a compilation error is marked as a ReSharper error, but you can prevent compilation by "promoting" lower-priority inspections to errors.
Languages->Naming Style: This section shows you how ReSharper will expect various types of code member names to be formatted. The "Advanced settings" option also contains the "abbreviations list", which is basically a list of exceptions to the normal camel-casing conventions. By default, all format inconsistencies are warnings, and I do not see a way in 5.1 (the version I use) to change the severity of this.
EDIT: Here's a list of inspections and their default severities for RS 4.5, which is a few versions back but should still have the "meat" of ReSharper's C# inspections. http://unintelligible.org/blog/2010/05/24/resharper-45-inspection-severity-list/
Beyond this, even JetBrains simply refers you to the Options window if you want to see the list of inspections for your current language. So, if you want something more up-to-date, you may have to do it yourself. If you do, be sure to post it somewhere so others don't have to repeat your work.
IMHO company coding standard is more than just formatting. It usually includes project organization conventions, library usage guidelines, etc. Listing every possible formatting rule ReSharper knows about will make it quite long and boring. Few examples for common constructs (which you can copy from bottom part of formatting setup window) should suffice. Providing them with short rationale should not be too hard to do manually.
I am about to make the switch to resharper from coderush after using it for 30 days and have some questions I would like to see if I can get some help on.
1: Can you change the resharper code colors? I tend to prefer dark themes so I would like to be able to migrate to a dark theme once the change is complete.
2: Do any other addin provide the member icon paint functionality of Coderush? It is the only feature that I do actually miss as it is handy for scanning. I don't mind paying for the functionality if it works.
EDIT: Found out how to change syntax colors.
There's no direct replacement of "paint member icons" in ReSharper.
I suggest that you use the File Structure window instead, with "Track caret in editor" and/or "Automatically scroll to source" options on to synchronize between focus in File Structure and the caret in the text editor.
As to other VS plug-ins, to my knowledge there aren't any prominent plug-ins that have that - neither VS10x CodeMap nor Productivity Power Tools provide anything similar.
1: Can you change the resharper code colors? I tend to prefer dark
themes so I would like to be able to migrate to a dark theme once the
change is complete.
As well as being able to change Resharper colours (In Tools->Options->Fonts and Colours, look for the "Resharper *" related options), R# supports Visual Studio light and dark themes:
http://www.jetbrains.com/resharper/webhelp/Managing_Color_Themes.html