Coding Helpers – Smart Enter
Smart Enter is intended to improve the usability of the Enter key while coding in the editor. If the feature is enabled and the Enter key is pressed, it moves the editor text caret to the next code line (starting it with the same amount of white space on the current line and adding a line statement terminator to the end of the current line if it doesn’t exist (.e.g semi-colon in CSharp) or inside of a code block, leaving the characters to the right of the source caret location at their initial position. It is activated if the character to the right of the current caret position is one of the following:
- ] (closing bracket)
- ) (closing paren)
- > (closing angle bracket)
- ; (semi-colon)
Here are the CSharp samples where Smart Enter feature may be useful:
1) Before Enter is pressed:
After Enter is pressed (notice the caret is moved inside of a code block):
2) Before Enter is pressed:
After Enter is pressed (notice the caret is moved to the next line, and a semi-colon is added to the end of the staring line):
The feature doesn’t depend on the current language used and should work everywhere when it is available. The most preferred language for this feature is CSharp, however. By default, it is disabled. To enable it, follow these steps to get to the Smart Enter options page:
- From the DevExpress menu, select “Options…” to open the Options Dialog.
- In the tree view on the left, navigate to this folder: “Editor\Auto Complete”.
- Select the “Smart Enter” options page.
- Check the “Enabled” checkbox.
There are no other options on this options page.
—– Products: CodeRush Pro Versions: 10.1 and up VS IDEs: any Updated: Oct/12/2010 ID: C031