Completion Helpers via TypeScript
For example, in the above use of
underscore.js, ReSharper is not able to infer the properties of the
_ (underscore) symbol, and thus the developer has to pick from all identifiers. In addition, function parameter information is not available.
After the addition of the strongly typed definitions from the
*.d.ts file, ReSharper shows the members that are permitted for the
_ symbol in bold, and proceeds to offer those members by default. This reduces the risk of error.
Also, ReSharper is able to provide information about function parameters:
So let’s start with a simple example of searching for a declaration of objects with a single property assignment:
The above pattern uses the Name placeholder to locate anything that can be considered a variable or property name. The Find Results window then gives you a listing of all the locations code matching the pattern has been found.
Of course, finding things is only half of what you can do, because you can also perform replacements. For example, say you wanted to replace explicit
Array declarations with square-brace syntax. Here’s how you would define such a pattern:
This pattern uses yet another placeholder which allows
$args$ to represent any number of arguments to a function.
It’s important to note that SSR mechanisms are semantically aware. Here’s an example: searching for a condition
$x$ > 100 will correspondingly match
if (100 >= x):
Similarly, prefix and postfix operators are matched interchangeably, assuming, of course, that no assignments are made:
Also note that SSR ignores non-significant tokens such as curly or round braces or semicolons:
And finally, it’s possible to generate search patterns directly from code:
File Structure Window Improvements
First of all, function names are inferred either from declarations or variable names:
ReSharper is also able to determine element names from documentation when they are not available explicitly:
The file structure window uses an ellipsis … to indicate additional arguments. Consider the
varArgsFunction below; it sees that the
arguments value is being used:
Some function call expressions actually represent higher-level constructs called modules. ReSharper attempts to recognize these structures and present both their private and exported members. Note that, for a constructor, we try to present its fields, too:
Smart Usage Search
That’s It (For Now)
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…