Xcode should not indent namespace contents
| Originator: | agentriot | ||
| Number: | rdar://31468712 | Date Originated: | 05-Apr-2017 |
| Status: | Resolved: | ||
| Product: | Developer Tools | Product Version: | 8.3 (8E162) |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
When working on a C++ project, it's a good idea to avoid usage of
using namespace Foo;
in implementation files. Instead, it's better practice to wrap the appropriate code inside a
namespace Foo {
// unindented code
} // namespace Foo
block. That allows for a finer and clearer control of which objects you are accessing, specially when accessing objects form different namespaces within the same file.
For this reason, I feel that not-indenting the code inside namespaces it's the best approach, because indenting namespace contents would makes deeply nested namespaces hierarchies to waste a lot of horizontal space.
Currently, Xcode indents namespaces contents automatically, and there's no way of disable namespace content auto-indentation without also disabling the (correct) auto-indentation after a other instances of code following an opening bracket (functions, if-loops).
I feel that if you ask C++ developers, they would prefer for Xcode to not indent namespace contents, hence I suggest that Xcode either:
a) Changes its behavior to not indent namespace contents (while still indenting other opening bracket cases).
b) Provides this as an option.
Note that, for example, clang-format provides this distinction (so you can disable namespace contents indentation, will keeping auto-indentation for other opening bracket usages), which should be proof that this is a pretty important setting.
Steps to Reproduce:
1. Open Xcode and write: 'namespace LS {'
2. Press enter.
Expected Results:
3. Xcode should not indent the new line.
(Or there should be an option to configure this).
Actual Results:
3. Xcode indents the new line.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Marked duplicate of 20700010 (Open) by Apple.