Previous posts introducing ReSharper 6:
- CSS Support in ReSharper 6
- ReSharper 6 Bundles Decompiler, Free Standalone Tool to Follow
- ReSharper 6 Enhances Suggestions with Explanations
- ReSharper 6 Enhances Razor Support
Code Completion for Selectors
When working with jQuery selectors we often need to lookup certain DOM elements or CSS classes in order to operate with them. This can result in a back-and-forth between the code we are working on and looking up of a specific element. ReSharper 6 facilitates these cumbersome operations by providing code completion for selectors:
This completion is invoked by typing
# between the quotes, where as if we were to type
., we’d get:
This completion is available anywhere a selector is required. Of course if we merely want to select a specific type of element, we also have completion:
Extending jQuery Extensions
One of the benefits of jQuery is the ease by which we can extend it to add our own functions and methods. ReSharper enhances this experience by providing completion also for custom extensions. For instance, if we were to write a new extension:
We now have myFoo available as a method of jQuery:
Much in the same way, if we want to extend an object:
Importing File References
Out of the box, Visual Studio requires a special comment to be added to script files to provide support for IntelliSense:
With ReSharper this is not required. If however, it is included, ReSharper will then limit the scope of Intellisense to the reference added. This reference can be provided by directly typing it in, in which case ReSharper offer completion:
as well as providing quick-fixes when errors are detected in paths:
Creating from Usage
generating the code for us, providing us the same ability we have in C# to iterate through parameter names etc. The same applies to variables:
as it does to creating parameters and properties; once again, making the whole development experience a bit smoother.
Last but not least, ReSharper also provides the ability to create jQuery extension methods from usage:
Introduce Variable is another refactoring option available:
And last but not least, Rename:
ReSharper is smart enough to handle the scope of the renaming outside of the current local scope, prompting you always with the option to fine-tune certain renaming’s.
Code Cleanup and Rearranging
Also, out of the box, we provide certain filters, both in clean-up and analysis, such as those with min.* extensions. These can be changed in the options dialog, albeit it’s not highly recommended.
You can now rearrange code which includes moving parameters around, moving members up/down as well as arguments and object literals and arrays. All this is done using the same key combination as used in C# and VB.NET (Ctrl+Alt+Shift + Cursor Keys).
- Syntax errors:
- Unused symbols:
- Dead code:
- Duplicate switch statements:
- Misuse of “this”:
- Accessing undefined global symbols:
And this is just a few of the over 25 inspections that ReSharper supports along with their corresponding quick fixes. We believe that this will help remove some of the issues encountered at runtime, specially by newcomers.
- Configurable Naming Conventions: Much like C# and VB.NET you can define your own naming conventions.
- Context Actions Settings: You can fine-tune which of context actions you want enabled.
- Coding Assistance: Syntax highlighting, highlighting for matching delimiters, ability to comment and uncomment blocks of code etc. See previous post for some screenshots.
ReSharper 6 is currently in EAP. Download it today and start playing with it. We’d love to hear your feedback..
Subscribe to Blog updates
Thanks, we've got you!
Eager, Lazy and Explicit Loading with Entity Framework Core
Entity Framework Core (EF Core) supports a number of ways to load related data. There’s eager loading, lazy loading, and explicit loading. Each of these approaches have their own advantages and drawbacks. In this post, let’s have a quick look at each of these ways to load data for navigational prope…
OSS Power-Ups: bUnit – Webinar Recording
The recording of our webinar, OSS Power-Ups: bUnit, with Egil Hansen and Steven Giesel, is available. This was the twelfth episode of our OSS Power-Ups series, where we put a spotlight on open-source .NET projects. Subscribe to our community newsletter to receive notifications about future webi…
Accelerating Your Testing Workflow with Unit Test Creation and Navigation
Unit tests play an important role in our daily development workflow. They help us ensure our codebase's correctness when writing new functionality or performing refactorings to improve readability and maintainability. In the process, we often create new test files that accompany the p…
Introducing Predictive Debugging: A Game-Changing Look into the Future
With the introduction of debugging tools, software developers were empowered to interactively investigate the control flow of software programs to find bugs in live environments. At JetBrains, we've always strived to improve the art of debugging. Besides the more standard things you expect from a de…