The first service pack for Telerik JustCode Q2 2011 was recently released, but the development team is forging ahead with even more new features to make your life easier. New internal builds brings Razor and CSS support, which is welcome news for web developers using JustCode.
If you have developed applications in ASP.NET MVC 3, you are familiar with the new Razor view engine. It brings code closer to markup, and it’s fitting that its files use the extensions cshtml and vbhtml.
The JustCode analysis engine has been augmented to detect Razor-specific syntax warnings and errors in addition to traditional code and markup issues. These are accompanied by appropriate messages to aid you in understanding what went wrong so corrections can be made.
The language quick fixes for which you are accustomed now work from within a Razor file.
When designing view-first, you will often find yourself in need of a model. JustCode allows you to create the model class or interface through the Create Class or Create Interface quick fix.
Using namespaces in Razor is different than in its hosted language. The namespace must be imported outside of a code block so it can be used throughout the file. JustCode properly detects the necessity of a namespace and offers a quick fix to add it.
Razor files consist of a mix of markup and code, and both sets of elements should be kept tidy. JustCode will organize and add missing using statements for you by pressing ctrl+shift+u.
JustCode is great for maintaining a consistent styling with code and markup, and the options for each will work within a Razor file. There are style decisions to be made that are specific to Razor, however, so we added them. They can be modified by going to JustCode User Options | Code Style | Razor | New Lines.
JustCode has superior code navigation to find what you need in your code base. This now works seamlessly from within a Razor file either by using a shortcut key, the JustCode menu, or through the Visual Aid.
CSS is an essential styling language for all web developers. It’s not only used in ASP.NET MVC but in WebForms as well. JustCode analyzes CSS files and styling inside of the <style> tag.
Nothing can be more frustrating than the misapplication of style because of syntax errors or a typo-induced invalid CSS property or value. These issues can be tough to track down on your own, but with JustCode you will know immediately when there is a problem.
Navigation has been enhanced to support CSS: Goto Member now supports CSS properties and selectors, Find Usages will search and display every occurrence of a class or id from a CSS selector, and a new feature, Find Matching CSS Rule Sets, detects all styles that apply to the element.
Selecting Find Matching CSS Rule Sets will display the results window.
The converse of this action is Find Matching Html Elements. This feature will find all Html elements that match a CSS selector.
Clicking Find Matching Html Elements in the Visual Aid will display the results window.
JustCode makes refactoring CSS, and oftentimes HTML by extension, painless. One refactoring, when done manually, is the sources of many bugs: Rename. Changing the name of a class or id from within a selector gives you the option to rename every occurrence.
You may have noticed the new refactoring, Convert Class Selector to ID Selector, in the image above. This may not appear to be much work on one selector, but JustCode will search for other selectors that matched the original to see if you would like to change them as well. This is important for maintaining consistency.
The final refactoring is Convert ID Selector to Class Selector. This does the opposite of the previous refactoring.
Wrapping It Up
Although ASP.NET MVC developers get a lot of good stuff in this release, WebForms developers get many new features as well. JustCode keeps you close to the code, without the need to run external programs to determine why your CSS isn’t being applied. If you don’t already have JustCode, download the free, 60-day trial today!