The formatter in Telerik JustCode is one of its many great features. Its main goal is to let you define and enforce your code style across your projects. It is a very important part of the product as it is used in many other places as well (for example typing assistance and refactorings).
The JustCode formatter is very configurable. You can find its options in the Code Style section of the JustCode options dialog:
You can also configure JustCode to share the Code Style options per solution. To do that, go to the Options Sharing page in the Options.
How to use the formatter
The formatter is triggered in several ways. The most trivial case is when you execute it manually from the Format Code command (Ctrl+Alt+F by default). It is also used by our refactorings, quick-fixes, templates, code generation, etc. It can also be executed as a cleaning step in the JustCode code cleaning feature.
Code style options
As we already mentioned, JustCode has an extensive set of code style options. To make it easy to configure we have separated them in sections. First, we have the supported languages then a logical separation of the different code style options. Of course not all of these sections are present in each language:
- General: general options, not related to any other section;
- Indentation: how to indent certain code constructs;
- Spacing: where to add/remove spaces in code;
- New Lines: rules according to which a certain code constructs are placed on new line or should be separated with empty lines;
- Blank Lines: how to manipulate an empty lines;
- Ordering: how to reorganize your code, such as sorting fields, properties, methods, etc.;
- Brace Positions: how the braces and the body of blocks, array or object initializers are formatted;
- Wrapping: code wrapping is a feature, allowing a line of code to be split in several lines if its length exceeds a given value. This section contains rules defining how exactly each code construct should be split in several lines;
- Using Directives: rules defining a set of using directives, which should be always imported and a set or using directives, which should always be kept from removing;
- Naming Conventions: how JustCode should name a certain code constructs or whether its analysis should report warnings about incorrect naming.
This was the first part of series of blog posts for JustCode formatter. We hope it will put some light on the JustCode formatter. There will be more blog post about Code Style options in details and Options sharing. Your feedback is welcome and appreciated. Write to us in forum or support.
Happy Coding! The JustCode team