[Webinar Recording and Q&A] ReSharper Secrets
The recording of our February 13th webinar with Igal Tabachnik, ReSharper Secrets, is now available on JetBrains YouTube Channel.
In this session you will learn about ReSharper hidden gems, powerful annotations and 3rd party plugins to help you become a true ReSharper ninja!
Watch as Igal takes you behind the scenes of ReSharper and shows you how to use this knowledge in your own code, to get even more out of ReSharper. The intended audience is intermediate-to-advanced ReSharper users.
We received a lot of questions during the webinar and we’d like to use this opportunity to include the most frequently questions, as well as those we didn’t have a chance to answer during the webinar.
Q&A on Igal’s Visual Studio setup and ReSharper plugins that he uses
Q: Where does that “number of references” annotation in Igal’s Visual Studio come from?
A: It is called CodeLens. This feature is a part of Visual Studio 2013 Ultimate but is not included in any of Visual Studio’s lower-end editions. Addressing a related question, no, we’re not planning to replicate the functionality of CodeLens in ReSharper.
Q: What ReSharper plugins does Igal use?
A: He uses a whopping 14 of them! Here’s the full list:
- Agent Mulder
- Enhanced Tooltip
- Nancy Plugin for ReSharper
- Preview Tab Behaviour
- Go to Word
- InternalsVisibleTo Helper for ReSharper
- NuGet support for ReSharper (bundled plugin)
- Postfix Templates
- ReSpeller Pro
- Live Template descriptions
- xUnit.net unit test provider
- Joar Øyen’s extensions for ReSharper
- Locate File or Folder in Solution Explorer
If you’re using ReSharper 8.0 or above, go to ReSharper | Extension Manager to install any of these plugins.
Q: What was the tool that changed .var into a variable assignment?
A: This cool plugin is called Postfix Templates. If you want to have it installed, go to ReSharper | Extension Manager | Online and search for postfix. If you’re ready to contribute, here’s the plugin’s github repo.
Q&A on code annotations
Q: Does using ReSharper’s code annotations have any performance impact?
A: No. They are just attributes, thus they do not affect your compiled assembly’s performance. As for ReSharper performance, the attributes are cached and the analysis is run even without attributes, so there is no performance difference there.
Q: What do I need to do exactly for importing the annotations?
A: There are two options. First, you can paste the source code of JetBrains annotations into your project. To do that, go to ReSharper | Options | Code Annotations | Copy default implementation to clipboard. Paste that into a new file, and you’re done. The second option is to reference a library called JetBrains.Annotations.dll that you can take from ReSharper’s installation folder.
Q: Can I have a single annotations file in the entire solution, or is Annotations.cs created for every assembly/project you create?
A: You are free to put Annotations.cs in a shared assembly, as long as it’s referenced.
Q: Do I need to ship the library containing annotations with my code?
A: If you add annotations by referencing JetBrains.Annotations.dll, then yes, you’ll need to ship the dll with your application. If you add them as a source file, they are compiled in your assembly, and there are no extra references to ship.
Q: What if a project uses ReSharper annotations, but another developer does not have ReSharper installed? Do these annotations work for them?
A: No, the warnings and analysis are provided by ReSharper. The annotations essentially provide hints for ReSharper’s analysis. If you don’t have ReSharper installed, they are just attributes that no one uses.
Q: Can I make ReSharper treat everything as [NotNull] by default so that and I can use [AllowNull] instead?
A: You can change ReSharper’s default assumption by going to ReSharper | Options | Code Inspection | Settings and change the value of Assume entity value can be null. The default value is optimistic (assumed to be not null) but you can change it to pessimistic (assumed to be null).
Q: Regards [Pure] can ReSharper not simply look at the method return type as not being void instead?
A: No, because e.g.
string.ToUpper() is a pure method. It returns a new string without changing any of the fields of the current string instance. Calling it without assigning to a variable is pointless. If we add [Pure], ReSharper will warn you that the return value is unused.
For more information on using code annotations, see ReSharper online help and two prior blog posts: ReSharper NullReferenceException Analysis and Its Contracts and Contract Annotations in ReSharper 7.
Join us Tuesday, February 25th for our next webinar, dotMemory 4: What’s Inside with Maarten Balliauw.
Subscribe to Blog updates
Thanks, we've got you!
Webinar: “New UI for Your IDE: A Glimpse Into the Future”
Join us Monday, October 31, at 5:00 pm UTC (check other timezones) for our live webinar, New UI for Your IDE: A Glimpse Into the Future. In this webinar, join our JetBrains Advocates as they share the New UI with you, giving you a glimpse at some of the visual improvements for IntelliJ Platform IDEs.
Software Development the JetBrains Way: Dogfooding and Other Key Principles
JetBrains has turned 20, and over the years, we've honed methods for development that match the style, values, and needs of our company. These processes work so well for us that we want to share them with others. Dogfooding, for example, has always played a central role in the development of our pro…
Join KotlinConf 2018 Online: Major Kotlin Announcements and Online Q&A
You can meet the JetBrains team at many tech events all over the world. But today we're offering something special – the chance to meet the Kotlin team from the comfort of your own home with KotlinConf 2018 Live. We are happy to invite you to our online event. Join the live stream on October 4-5. …
Join the “GitHub and IntelliJ IDEs” Webinar
GitHub helps teams collaborate around code and work together, and JetBrains IDEs help keep GitHub versioning working productively without switching contexts. Our IDEs also put a pretty face on sometimes cryptic Git commands while preserving the power of high-end versioning productivity. GitHub is…