Preventing Items from Being Analyzed in ReSharper
Eliminating Items from Analysis
ReSharper allows us to completely exclude specific files and folders from Analysis. Currently, it does not support file masks, so we cannot tell it to ignore all *.less files. What we can do however is place all files of a certain type into a folder and add that folder to be excluded. To do this, we first move the specific files by using the “Move To Folder” refactoring and create a new folder called less for instance (which can be created using the same dialog).
In order to now exclude this folder, we need to go to ReSharper | Options | Code Inspection |Settings:
and click the Edit Items to Skip button. This now lets us add specific files and/or folders to the list of items to skip.
We then click Add Folder and select the newly created folder (less). Once we do that, all analysis on the skipped items will stop. Obviously this is available for any kind of file so you can add anything there.
Note: You can also add/remove files and folders quickly by pressing the shortcut key Ctrl+Shift+Alt+8.
In the case of CSS/.less, if you still see squiggles under certain elements, that is Visual Studio error highlighting, not ReSharper. You can turn that off using Tools | Options | Text Editor | CSS | Miscellaneous.
Below the previous menu option, there is another entry, Generated Code:
How is this different from the above? The entries on this page, which do allow masks (as well as regions), do get analyzed, yet no hints, warnings, suggestions or quick fixes are offered since it does not make much sense. However, and this is important, files still do get analyzed to provide error information and completion. This is what makes Generated Code different from Items to Skip.
Note: In ReSharper 6 and below, Generated File Masks and Generated Code Regions are GLOBAL and not Solution based. However, they can only be edited when a solution is open. This will be solved in a future release along with other improvements in the area of settings across solutions/projects.
Subscribe to Blog updates
Boost Code Quality with Qodana and GitHub Actions
It’s been roughly half a year since we introduced Qodana to .NET in our blog post about how to elevate your C# code quality with Qodana. Since then, we’ve been quite busy! Qodana went out of preview and into GA. Furthermore, we greatly improved the integration with our IDEs, providing an effortless …
Critical Thinking in an AI-Powered World
Critical thinking techniques for use with JetBrains AI Assistant.
How To Use AI Assistant to Generate Test Data For .NET Applications
How To Use AI Assistant to Generate Test Data For .NET Applications for better unit tests.