Parentheses added around highlighted statement add new lines

Lately I've noticed that adding parentheses around a highlighted statement puts them on new lines above and below the statement.

Expected

(greeting)

Actual

(
    greeting
)

I can't attribute the change in behavior to a specific version but I'm currently on 14.2 (14C18).

Is this a preference or is something else going on?

Answered by DTS Engineer in 745152022

This is apparently a bug in Xcode 14. It happens when you select entire lines (with or without the final end-of-line delimiter).

Please file a bug report against Xcode: https://developer.apple.com/bug-reporting/

That's defined in Preferences "Enclose selection in matching delimiters:

  • deselect the option, and typing ( will replace selection by (.
  • select the option and you get the behaviour you described.
  • same behaviour with any delimiter like curly brace { or quotes
  • but the line insertion is specific to some delimiters as (, {
Accepted Answer

This is apparently a bug in Xcode 14. It happens when you select entire lines (with or without the final end-of-line delimiter).

Please file a bug report against Xcode: https://developer.apple.com/bug-reporting/

Parentheses added around highlighted statement add new lines
 
 
Q