CodeRush Classic (CRC) gets two new features in 15.2.
Note that most of our development effort is currently directed toward CodeRush for Roslyn (CRR) which is driven by 45-day sprints between releases. We’ll talk about new features in CodeRush for Roslyn as those releases become available.
In CodeRush Classic, we’ve found clever ways to improve the speed of Quick Nav, making it significantly more responsive.
Also, CodeRush Classic gets two new features in this release:
CodeRush classic gets Code Coverage, which tells you how much of your application is covered by test cases, which can be one indicator of overall code quality. This feature is also useful when maintaining code – you can get a clear picture of how safe it is to change methods or even individual lines of code. If the code you want to change is covered by test cases, it is safer to change that code (because the test cases covering the code you want to change increase the chances you’ll know immediately if you unintentionally break something).
To see Code Coverage, you need to first run your tests from the CodeRush Unit Test Runner using one of the two orange test tube icons at the top:
These icons run your tests so CodeRush watches for coverage.
The orange test tube button with only a single green triangle ( ) shows coverage provided by only the selected tests.
The orange test tube button with two green triangles ( ) shows coverage provided by all your tests.
Regardless of which button you press, after the test run is complete, CodeRush reports the results in the Code Coverage window, which looks like this:
The Code Coverage window provides a hierarchical view of the projects in your solution, and shows the code coverage results for each member, type, namespace or project. Results are summarized in the percent graphs on the right, showing the lines of code covered over the total lines of code.
The Code Coverage window optionally shows you a code preview in a separate pane, shown in the screenshot above. Code highlighted in green is covered – that means at least one of the test cases resulted in that line of code being executed. Code with a gray background is not covered by the tests that were run.
You can bring a method of interest to focus inside the Visual Studio editor by right-clicking that node in the tree view and choosing “Go to Method”.
Paste as Xaml/Svg
This is one of the more interesting features we’ve introduced in some time, and it’s for developers who are creating applications and web sites that need scalable graphics. Up until now, creating vector graphics for your applications has been relatively painful, especially if your team lacks a dedicated graphic designer. Existing vector graphic editors are either functionally weak or they require a sequence of tedious export/import steps to get those vector graphics from the graphic editor into Visual Studio.
CodeRush Classic 15.2 solves this challenge rather elegantly, with the new Paste as Xaml/Svg code providers. Just design or open the graphic in your vector editor of choice (Microsoft® Visio, Microsoft® PowerPoint, Adobe® Illustrator, etc.), copy it to the clipboard, and then paste the graphic inside Visual Studio (inside a XAML file or an HTML file using Ctrl+V or Shift+Insert). CodeRush will convert the vector data on the clipboard into XAML or SVG automatically. You can also press the CodeRush key to bring up the CodeRush menu and choose Paste as Xaml or Paste as SVG.
To be clear, here are the steps:
1. Create or open your vector shape in the vector editor of your choice:
For example, I used PowerPoint to create the gear shown above by forming a union with four rounded rectangles and a circle, and then subtracting a circular hole from the center (you can create this custom shape in PowerPoint in about 45 seconds – it’s that easy).
2. Copy your custom shape to the clipboard.
3. Paste into the XAML code or into an HTML file inside Visual Studio:
Of course, you can adjust properties after the paste, such as height/width, fill, stroke, etc.
Here’s the same gear that I created in PowerPoint pasted inside Visual Studio as SVG (and then copied and pasted here into this post):
<svg height="352px" width="351px" viewBox="0 0 351 352">
<linearGradient id="gradient0" y2="0%" x2="100%" y1="0%" x1="0%">
<stop style="stop-color: #2e75b6; stop-opacity: 0.5" offset="0%" />
<stop style="stop-color: #2e75b6; stop-opacity: 0.5" offset="100%" />
fill="url(#gradient0)" stroke-width="1" stroke="#1F4E79" />
If you would like to see how this SVG renders in your browser (with an added animated spin), click here.
So now it’s easy to create your own custom vector graphics and use them inside your XAML applications and web sites.
As always, let us know what you think.