Can ReSharper ignore projects/tests in navigation - resharper

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

Related

Filter Rider Explorer Solution View

Does anyone know if Rider support filtering in its Explorer view?
I typically want my solution to include all projects, so when I search/build, I got everything. But in the meantime, the whole explorer tree is so overwhelming. I may focus on different subset of the solution in different time, hence I want to filter on a particular projects/folders that I am interested in.
I know in VSCode we could do filtering to show/hide certain items using settings in files.exclude. Does Rider have a way to achieve something similar?
Feel free to upvote this feature request:
https://youtrack.jetbrains.com/issue/RIDER-16273/Scopes-not-available-on-solution-explorer
Right now (2022 year) it is only possible to search in the explorer tree

Stop ReSharper cleanup from reordering unit tests

Currently when I run Full Cleanup on a file with NUnit tests R# totally ruins it. For some reason it reorders the methods with [Test] in alphabetical order. How can I turn this "feature" off?
I'm using version 9.2.
This is explained in the documentation here
you need to go to Code Editing | C# | File Layout page of ReSharper options and then remove the default NUnit layout pattern (or change it so that it doesn't reorder alphabetically)
The simplest way to do this via the ui (which seems to be very confusing) is to double click each Type Pattern and make sure you are in composition view (click the icon in the top right corner until its a cog) then double click the method Entry elements until you find the one which has the constraint for the attribute for NUnit framework (somethign like this):
and then change the Sort By option in the bottom right of the main settings window to be none

Creating custom search button in Notepad++

I am looking for a way to create custom buttons for Notepad++. So far I haven't been able to find solutions regarding this.
The buttons would be doing a regular expression search and highlight the search results as well. This would make it much easier for me to analyze error logs. This would eliminate the need of copy/pasting the long regex search queries.
I'm trying to use the Customize Toolbar plugin to accomplish this, but I couldn't find a thorough documentation of it and therefore having troubles.
Any help would be appreciated.
There you go:
Download "Customize Toolbar" from the "Plugin Manager"
Go to menu "Plugins" > "Customize Toolbar" and select "Custom Buttons"
Restart Notepad++
Now it's the important part, where you need to create the button's functionality. In your case you want to simply search and fortunately this can be implemented in a Macro. If you need something more complex that can't be recorded in a Macro, consider the use of "Python Script" plugin (which is really easy even with a minimal knowledge of Python) or writing your own plugin (which I guess is more difficult, I never tried to). So, let us assume that you recorded a Macro and you named it "test".
Find and open the file %APPDATA%\Notepad++\plugins\config\CustomizeToolbar.btn
Add the following new row in the file:
Macro,test,,,
That's all. You now have a new button in your toolbar that runs your macro.

Adding to ReSharper's 'Related Files' list

From version 5.0 onwards, ReSharper offers a "Go To Related Files" navigation which offers a list of files that R# thinks are related to the file currently being edited: for example, base types, derived types, .designer.cs to and from the relevant .cs, and so on.
I have looked in the R# Options and also online, but have not been able to find out:
Is there a way to add files to this list, either within R# natively or by an already-existing plug-in?
(My motivation is to be able to navigate at coding time between files containing classes that are connected by a run-time-only convention-over-configuration, er, convention)
I don't know about existing plugins, but this feature is extendable.
You need to implement IRelatedFilesProvider interface in your plugin and mark it by RelatedFilesProvider attribute. As far as I know, NHibernate plugin do it for analogous task.

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