# What's New in v21.2.5 ## File-scoped Namespace Declaration Support for C# 10 The following refactorings can now be used in C# projects containing file-scoped namespace declarations: * Sync Namespace with Folder Structure * Move File to Folder * Move Type to Namespace * Move Type to File * Declare Partial Class Part * Declare Partial Record Part * Extract Interface The screencast below shows the "Move Type to File" refactoring in action: ![](https://i.imgur.com/rzxEogg.gif) We've also updated the CodeRush formatting engine to support the new C# 10 namespace declaration style as well as C# 10's new global using directives feature. ## Sync Namespace with Folder Structure You can now apply the "Sync Namespace with Folder Structure" action in partial classes and in a copied folder that contains at least one .cs or .vb file. The namespace in copied files will be renamed according to the new files location. ![](https://i.imgur.com/8Scx5ms.gif) ## Records and Record Structs Support CodeRush now supports **records** (for C# 9) and **record structs** (for C# 10) in the following features: ### Code Cleanup You can apply the following [code cleanup rules](https://docs.devexpress.com/CodeRushForRoslyn/401352/code-style-assistance/code-cleanup/code-cleanup-rules): * Remove unused types ![](https://i.imgur.com/9zPoN20.gif) * Apply visibility style ![](https://i.imgur.com/OCWQSpO.gif) * Sort modifiers ![](https://i.imgur.com/66tPyqU.gif) ### Smart Constructor The [Smart Constructor](https://docs.devexpress.com/CodeRushForRoslyn/401059/coding-assistance/declare-menu/declare-providers/constructor) feature now works with positional records: ![](https://i.imgur.com/DQDi0il.gif) ### Diagnostics The [Code Issues window](https://docs.devexpress.com/CodeRushForRoslyn/401558/static-code-analysis/code-issues-window) can display the "Unused Type" and "Unused Member" code analysis diagnostics for unused records and record structs: ![](https://i.imgur.com/MEUICTO.png) ## Caps as a Shortcut Modifier You can now use the **Caps Lock** key as a shortcut modifier (just like **Ctrl**, **Shift**, or **Alt**) to create shortcut bindings for your favorite CodeRush commands and quickly access a wide range of CodeRush functionality (refactorings, navigation, declarations, and more). This feature also lowers the risk of unintentionally engaging **Caps Lock** - an accidental tap of the key no longer toggles the **Caps Lock** state in Visual Studio. If you ever do need to toggle **Caps Lock** on (or off), just quickly tap the **Caps** key twice. To enable **Caps Lock** as a modifier: run the [Setup Wizard](https://docs.devexpress.com/CodeRushForRoslyn/116252/getting-started/first-steps#setup-wizard) and check the **Enable Caps as a Modifier** checkbox on the **Caps as a Modifier** setup page... ![](https://i.imgur.com/SLFB0nW.png) or activate the "**Caps as a Modifier**" option on the **Quick Setup** options page. ![](https://i.imgur.com/orlDdfD.png) Once you enable "Caps as a Modifier", you can quckly access a number of features that make development faster and easier. For example, you can use **Caps+Space** to compress to or expand from [Implicit/Explicit Declarations](https://docs.devexpress.com/CodeRushForRoslyn/115552/refactoring-assistance/make-implicit-explicit), [Expression Bodies](https://docs.devexpress.com/CodeRushForRoslyn/115599/refactoring-assistance/use-expression-body), [Ternary Expressions](https://docs.devexpress.com/CodeRushForRoslyn/115431/refactoring-assistance/compress-to-expand-ternary-expression), [Null Coalescing Operations](https://docs.devexpress.com/CodeRushForRoslyn/115402/refactoring-assistance/compress-to-expand-null-coalescing-operation), and [Initializers](https://docs.devexpress.com/CodeRushForRoslyn/400684/coding-assistance/code-providers/initialize). You can even use Caps+Space to [Inline Temporary Variables](https://docs.devexpress.com/CodeRushForRoslyn/115550/refactoring-assistance/inline-temp). The screencast below shows how to toggle with Caps+Space to make explicit variable declarations implicit: ![](https://i.imgur.com/aJ1p0ad.gif) To quickly declare a classes, members, and locals, just press **Caps**+ *the First Letter* of the desired element to create. For example, press the **Caps** key along with the letter **F** to declare a **field** variable initialized to this parameter. ![](https://i.imgur.com/vORKMp4.gif) Similarly, **Caps**+**P** declares properties, **Caps**+**M** declares methods, and **Caps**+**L** declares locals (based on an expression entered on a line). **Caps**+**C** will declare a class, and **Caps**+**Q** will declare constants (consistent with using "q" to create constants in CodeRush templates). To learn more about these, see the [Caps as a Shortcut Modifier](https://community.devexpress.com/blogs/markmiller/archive/2021/11/04/caps-as-a-modifier.aspx) blog post. The new **Caps Lock** shortcuts for refactorings and code providers use an enhanced "ExecuteRefactoring" command, which allows you to specify multiple refactorings and code providers (that you want to all bind to a **single shortcut**), listed in the key binding's **Parameters** textbox. If you want to take a peek, you can see the mechanics of what we've done on the **IDE** | **Shortcuts** options page. ![](https://i.imgur.com/vQHrgPb.png) ## Smart Navigation (SmartNav) The new SmartNav feature allows you to quickly navigate between adjacent members, statements, and arguments in C#, Visual Basic, and TypeScript/JavaScript, and also between controls and properties in XAML and XML. To use SmartNav, first enable the "Caps Lock as a Modifier" feature (see the section above), and use **Caps** + *the Arrow keys*. In the screencast below, we're quickly changing the visibility of several methods by first navigating through them with **Caps**+**Down**, and then [cycling visibility](https://docs.devexpress.com/CodeRushForRoslyn/119941/coding-assistance/typing-helpers/cycle-scope-up-down) with **Alt**+**Up** and **Alt**+**Down**. ![](https://i.imgur.com/svrq5iH.gif) If you add the **Shift** key to any of these shortcuts (for example, **Caps**+**Shift**+**Down**) you can introduce a smart selection at the landing site. This can be useful for both viewing and changing values for matching properties in XAML. ![](https://i.imgur.com/Z5sUwh8.gif) Note that pressing the **Shift** key optional after you have created the first selection. If you are using SmartNav and you already have a selection, SmartNav will try to preserve it in the move (so only **Caps**+*arrow key* would be needed after a selection was first created with **Caps**+**Shift**+*arrow key*). ## The Learning CodeRush Solution This release introduces the "Learning CodeRush Solution" containing **interactive lessons** to help you learn **Caps Lock** shortcuts and help you practice new CodeRush features. To open this solution, select the **CodeRush** | **Support** | **Open Learning CodeRush Solution…** menu item or click the big **Open Learning CodeRush Solution** button on the last page of the Setup Wizard. ![](https://i.imgur.com/nmMMuuc.png) The Learning CodeRush Solution is just a small sample of what it could be. If you like this, and you'd like to see us invest more in interactive code-based learning to help you get up to speed faster in CodeRush, definitely let us know (support@devexpress.com). ## New Shortcut Cheat Sheet Following the introduction of Caps as a Modifier and SmartNav, we have updated our CodeRush Shortcut Cheat Sheet. ![CodeRush Shortcut Cheat Sheet](https://community.devexpress.com/blogs/markmiller/Images/CodeRush%20Cheat%20Sheet%20v4%20small.png) You can get version 4 of the [CodeRush Shortcut Cheat Sheet here](https://community.devexpress.com/blogs/markmiller/archive/2021/12/10/coderush-cheat-sheet-v4-0.aspx). ## Short Descriptions for WN Hint **C# 10 Support** File-scoped namespaces, records and record structs support in code cleanup, smart constructor and diagnostics. **Sync Namespace with Folder Structure** "Sync Namespace with Folder Structure" now works in partial classes and in a copied folder. **Caps as a Modifier** You can now use the **Caps Lock** key as a shortcut modifier (like **Ctrl**, **Shift**, or **Alt**). Enable in the Setup Wizard to quickly access to a large range of CodeRush functionality. **SmartNav** SmartNav navigates between adjacent methods, parameters, controls, and properties. Access with Caps + arrow keys. **Learning Solution** With the Learning CodeRush solution, you can learn and practice new CodeRush features. Open in the CodeRush | Support menu or on the last page of the Setup Wizard. ## Resolved Issues [T1046708](https://www.devexpress.com/issue=T1046708) - Formatting - Classes are incorrectly indented when the C# 10 File Scoped Namespaces feature is used [T1046716](https://www.devexpress.com/issue=T1046716) - Formatting - Incorrect formatting when the C# 10 Global Using Directive feature is used [T1043480](https://www.devexpress.com/issue=T1043480) - Formatting - The 'Wrap if long or multiline' option incorrectly works in the 'Type Parameters' rule [T1047439](https://www.devexpress.com/issue=T1047439) - General - A memory leak occurs when using Jump to Symbol [T1043539](https://www.devexpress.com/issue=T1043539) - Options - Checkbox text is not visible on the Editor/C#/Programming Style options page [T1051902](https://www.devexpress.com/issue=T1051902) - Options - The template editor's font size is too small if there are no open files [T1043856](https://www.devexpress.com/issue=T1043856) - Options - The Training window creates empty items after default colors are changed [T1051922](https://www.devexpress.com/issue=T1051922) - Refactorings - "Break Apart Arguments" inserts unnecessary lines and makes code uncompilable [T1051884](https://www.devexpress.com/issue=T1051884) - Refactorings - "Extract Interface" creates a sealed interface for a sealed class [T1042373](https://www.devexpress.com/issue=T1042373) - Static Code Analysis - The 'Name does not correspond to Naming Conventions' (CRR1000) analyzer does not work [T1045955](https://www.devexpress.com/issue=T1045955) - Test Runner - A performance issue occurs when updating tests [T1051916](https://www.devexpress.com/issue=T1051916) - Test Runner - Performance issues occur when the layout is switched to flat mode and not all tests are collected [T1046414](https://www.devexpress.com/issue=T1046414) - Test Runner - Test Runner crashes if .NET 6 tests run on multi-targeting project layouts