Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 10: Auto insert closing braces bug

Tags:

swift

xcode10

In Xcode (swift file), I'm facing an issue where automatic insertion of closing brace is not working anymore.

Ex: when I write

func myFunc() {

and hit Enter, Xcode will not insert the closing brace, and I need to do it by myself (and I'm very angry about it...)

Yet, my settings seem to be good: Preferences -> Text Editing tab -> "automatically insert closing braces" == true

It seems to happen for each file containing commented code, especially this (very common) piece of comment : //}

Configuration: Xcode Version 10.0 (10A255)

Steps to reproduce on a new Playground:

  1. Copy and paste the following comment : //}
  2. Then type : func test() {
  3. Then hit enter

It definitely seems to be a bug in the text editor. Already filed with Apple bug reporter.

Can everyone reproduce the bug or is it due to some configs ? And if so, what can I do to fix it ?

like image 529
Laurent Maquet Avatar asked Nov 15 '18 09:11

Laurent Maquet


1 Answers

I'm using Xcode 10.3. I've discovered if I have comment blocks in a file, then Xcode won't auto insert a closing bracket in that file.

/*
Temporary fix.  Replace this...
*/

//
// ...with this
//
like image 127
Steven Silvey Avatar answered Nov 15 '22 05:11

Steven Silvey