Xcode 9 indents Tabs incorrectly

Originator:tempelmann
Number:rdar://33423709 Date Originated:July 20 2017
Status:Closed Resolved:
Product:Xcode Product Version:9.0b3
Classification:Bug Reproducible:Always
 
Summary:
It appears that Xcode 9 has changed the way indentation of Tab chars is calculated, leading to out-of-alignment formatting of lots of code.

Steps to Reproduce:
Open the attached text in both Xcode 9b3 and 8. Note that "attrlist_t" and "fssearchblock_t" are supposed to be vertically aligned. In Xcode 8 they are, in Xcode 9, they are not.

Expected Results:
correct alignment

Observed Results:
incorrect alignment

Version:
Version 9.0 beta 3 (9M174d)


Attached text for demonstration:

// The identifiers (attrlist_t, fssearchblock_t) should be indented at the same position on screen, provided TAB width is set to 4 spaces,
// and using a fixed-width font (e.g. Menlo 11).
// That's happening in BBEdit as well as in Xcode 8 and every other common programming editor I did try.
// However, Xcode 9b3 indents these incorrectly, shifting the fssearchblock_t to the left, requiring ANOTHER Tab char to align it with attrlist_t.
// That's not good as it would mess up any such indentation suddenly for practically all existing code.

;	;	;	;	;	;	;	;	;
typedef struct attrlist			attrlist_t;
typedef struct fssearchblock	fssearchblock_t;


Resolution from ADR:

Issue the following Terminal cmd:

defaults write com.apple.dt.Xcode NSFontDefaultScreenFontSubstitutionEnabled NO

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!