ReSharper wants to replace for-each by LINQ queries. I don't like that, and I don't want ReSharper even suggesting it.
How can I disable this?
I cannot find this in the ReSharper settings.
I don't want this // ReSharper disable LoopCanBeConvertedToQuery to be around each for-each.
I have a newer version, ReSharper 9, but here it is under ReSharper > Settings > Code Inspection > Inspection Severity. I think it might be there in your version as well.
There is a long list of all things it can show improvements on. Somewhere in there is Language Usage Opportunities which has two settings about loops and LINQ.
In ReSharper 9 there is also a possibility to search the settings above the treeview on the left or above the list in the Inspection Severity screen. Just type 'LINQ' there and it will show you the settings described above immediately.
Related
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.
When using the various navigation and usage features of ReSharper, is there a way to make it hide some of the projects (with tests) in the solution?
Often when I'm browsing through the code, I'm not really interested in the tests, but only the production code.
I received this answer from the Resharper support team.
I have looked at "find usages" deeper and figured out that there is the
following item in filter dropdown -- "Show Unit Test Usages" (attached). So
if you uncheck this item -- usages from Test Projects won't appear in search
result.
Well im not sure this works for the navigation and usage features but for analysis it does, tryto use the skip files and folders menu to add folders which should be excluded.
Under Optionmenu use Settings under the Code Inspection section and select "Edit Items to Skip" and select your folder.
Take a look at this Article too
First, there's no setting in ReSharper to "forget" a certain project in solution.
However, in some cases, navigation combos may help you out.
For example, when you search for types, files or symbols with ReSharper, you can restrict search scope with navigation combos. Say, in NHibernate, entering "dm spec " in Go to Type restricts search scope to Projects\Core\NHibernate.DomainModel\NHSpecific
How to setup ReSharper to call "Sort usings" in class?
I will answer for my question.
Using shortcut from Resharper it's not best solution. Nice tool is CodeMaid it makes few nice cleanup's when saving file like with no shortcut key press:
sorting usings alphabetically and remove unused
deleting empty lines
This tool is complement for Resharper.
Resharper (9) will sort usings if you run Code Cleanup, via menus or keyboard shortcut CTRL+E, CTRL+C
Try using the Stylecop Resharper Plugin
Stylecop Rule SA1210: Using directives must be sorted alphabetically by the namespaces will allow you to use a quick fix to sort them by pressing ALT+ENTER.
Using Stylecop is good at helping you write clean code, but you may want to turn off some of the rules.
You don't need ReSharper to do this. By Default the shortcut CTRL+E, R will remove (unused) and sort the using statements.
If you only want sorting or the shortcut isn't set on your instance of Visual Studio, go to:
Tools-> Options.
Environment -> Keyboard
Search for "Editor.ContextMenus.CodeWindow.OrganizeUsings".
There are a few options there to play with.
This question already covers this:
Remove unused Usings across entire assembly
The feature is in ReSharper 4.5. If you right click on the solution,
there's a Cleanup Code... item, which allows you to apply a cleanup
profile to the solution. You can create a new cleanup profile from the
Code Cleanup node within ReSharper options, if you want a profile to
just adjust the using directives.
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/
I'm using ReSharper for my solution (that contains 10 projects) and I'd like to see the hints/suggestions/warnings/errors (listed in a window) for a chosen project. How can I do that?
Note: the solution analyzer window shows only errors.
In ReSharper 5, you can right-click solution explorer and select Inspect Code. It will show you all the issues found in the selected scope. There is a button on the toolbar to filter issues.
Doesn't seem to be an available option with the current release of Resharper...
We are not going to include warnings
in SWA in ReSharper 4 release cycle.
This is due to complexity of some of
analyses, due to complexity of UI to
deal with thousands of possible
warnings, and so on and so forth. We
are going to improve SWA in many ways,
we have a lot of plans, but they need
some time to implement. I can't say
any specific dates right now, but I
think we can add more solution-wide
features in the next major release
after ReSharper
4.0.
As a workaround, you can set severity of warnings you are
interested in to the "error" level.
You may have to restart VS to force
SWA reanalyse files.
Source:
http://www.jetbrains.net/devnet/thread/273096