Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAngela Anders
1,844 PointsCurly braces to open up a scope
I always look for easy way to do things. In the video when Craig, opens up a new scope with curly braces {} it seems that the ending curly brace automatically lines up with the first character of the first line. Is there an easy way to make that happen without backspacing or arrowing over? Sorry let me know if I'm not asking this question clearly enough. Thanks
1 Answer
Daniel Medina
13,863 PointsHello Angela,
Automatic code formatting is available in most modern IDEs.
Eclipse
Auto-formatting:
https://stackoverflow.com/questions/234594/eclipse-can-you-format-code-on-save
IntelliJ IDEA Formatting on save (requires plug-in): https://stackoverflow.com/questions/946993/intellij-reformat-on-file-save
Formatting shortcut: https://stackoverflow.com/questions/17879475/how-enable-auto-format-code-for-intellij-idea
VS Code Extension for auto-formatting: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Shortcut: https://stackoverflow.com/questions/29973357/how-do-you-format-code-in-visual-studio-code-vscode
I hope this helps!