JetBrains Rider 2024.1 Help

Code Style Assistance in XAML

JetBrains Rider provides a lot of features for keeping your code neat and clean. Being tightly interwoven with the majority of other JetBrains Rider's features, they help you produce code and change existing codebases according to the specific code style. The code style, which includes naming standards, formatting rules, and many other tiny aspects can be configured to a very detailed level and shared across your team.

Similarly to other languages, all XAML code style preferences can be applied in the desired scope with a single command using either Fix in scope or Code cleanup.

JetBrains Rider provides the following code style assistance features in XAML:

Naming Style

JetBrains Rider helps you define, control, and apply desired naming styles for symbols in your code. There is a set of rules, each of which targets specific identifiers with the set of constraints . Each rule can have one or more associated styles that define capitalization of compound words, underscores, suffixes, prefixes, and so on.

These rules are taken into account when JetBrains Rider produces new code with code completion and code generation features, applies code templates and performs refactorings. JetBrains Rider also helps you detect and fix violations of naming rules. If necessary, the automatic checkup of naming rules can be configured or disabled.

For more information about configuring and applying naming style, refer to Naming style

Managing and applying code formatting rules

An important aspect of code style is how to format the code, that is, how to use whitespaces, tabs, and line breaks to arrange code elements, whether and how to use tabs for indents, whether and how to wrap long lines, and so on.

The extensive set of JetBrains Rider code formatting rules has a default configuration that takes into account numerous best practices. You can configure every detail of formatting rules and enforce the rules in your code. These rules are applied when JetBrains Rider produces new code with code completion and code generation features, applies code templates and performs refactorings. The formatting rules can also be applied to the existing code in the current selection, current file, or in a larger scope up to the entire solution.

JetBrains Rider stores formatting preferences using the mechanism of shared settings. You can configure formatting rules in options pages under the Editor | Code Style | XML group. You can also store and share formatting settings in the EditorConfig files.

Collapsing empty tags

With JetBrains Rider, you can collapse empty tags in the selection, document or any other scope up to the entire solution. To collapse empty tags, run code cleanup in the desired scope with the 'Full Cleanup' profile or create a custom cleanup profile and tick the Collapse empty tags checkbox in the XAML section of the profile settings.

Last modified: 22 February 2024