3

I have had an issue with syntax highlighting/coloring since Xcode 9.3.0. I work in multiple tabs a lot. Sometimes I have the same file open in multiple tabs to either have reference to different parts of the file or if I'm using one with the debugger and the other for reference.

Since 9.3.0, when I launch my app with a file open in more than one tab, I lose part of the syntax highlighting. It seems to be mostly custom classes, (green in the dusk color scheme). This can be very tedious with debugging as I have Xcode set to open a preset 'Debug' tab when it hits a breakpoint. Essentially I will have a file open, launch the app, hit a breakpoint, Xcode opens the same file in the 'Debug' tab, and I lose syntax highlighting when I need it most, to debug.

I have tried the following - Delete derived data folder - Quit Xcode - Restart computer - add $(SRCROOT) to header search paths - cleaned project - cleaned build folders

Please note, I have also tried this on a brand new project with only a couple of classes and just a few lines of code. It still happens.

Please also note, I have tried installing a fresh version of Xcode on a brand new user account, devoid of ALL my previous xcode settings and preferences. It still happens.

I have also downloaded 9.3.1 and tried it. It still happens

This is driving me crazy. I would absolutely love to find a solution to this. I'm hoping this gets to a boss source kit expert who can be my hero!

Example of working syntax-highlighting: syntax coloring working

What it looks like after building: enter image description here

Update: 5/18/18 : Here's a video of what is happening https://youtu.be/fpWV_x17J7U

Update: 5/18/18 Tested on 9.2.0, doesn't happen, only on 9.3.0 and 9.3.1

Update: 5/18/18 Just tested on a friend's computer and can confirm this is happening for him as well.

Steps to reproduce.

• Update to Xcode 9.3.0 or 9.3.1

• Download and open this basic sample project : https://github.com/provmusic/syntaxHighlightingBug

• Open ViewController.swift

• Build -> Syntax coloring still in tact

• Open a new tab, now having ViewController.swift in both tabs

• Build -> Syntax coloring breaks

Jared
  • 793
  • 6
  • 16
  • 1
    I also use the dark scheme, and this happens to me all the time. One scenario is after using the refactor->rename function to rename a class/file. Drives me nuts, but I’ve found no way to (reliably) restore the highlighting other than simply reopening the project. – ABeard89 May 18 '18 at 13:36
  • Along with other editor crashes, like typing `_ in` (underscore first) into a trailing closure to ignore the parameter, I’m pretty convinced this is simply a bug Apple will need to solve. (And they seem to be taking their sweet time doing so...) – ABeard89 May 18 '18 at 13:41
  • Same for me, this happens a lot. I see you have a video: please report the bug to Apple and include the video, I'm sure it will help them fix this. – Eric Aya May 18 '18 at 22:50
  • @Moritz thank you for testing I have filed a bug report and included the video. Cheers! – Jared May 18 '18 at 23:04
  • I am also having this problem, both in Xcode 9 and now Xcode 10 beta. – Michael Dziedzic Jun 05 '18 at 23:24
  • Would you guys mind upvoting the question to get more visibility? Still no word from Apple. – Jared Jun 07 '18 at 05:44

2 Answers2

0

For me it was the _code in the first line from above:

if let err = err, let errorCode = StorageErrorCode(rawValue: err._code) {
        if errorCode == .objectNotFound {
          print("Asset not found, no need to delete")
          completion(true, nil)
          return
        }
      }

Commented out and back agan solved the problem.

Rebeloper
  • 813
  • 10
  • 22
  • Hi, are you Alex from Rebeloper? I've watched your videos on YouTube! – Jared Jun 25 '18 at 16:12
  • Also, I've tried this with a number of different code samples on new projects, it happens with pretty much everything. What fixes it for me is just editing the code, for example, type space and then delete it. The issue/annoyance is when debugging, you have to stop the process, edit the code and continue every time your code hits a breakpoint. This is less than ideal and has increased my workflow time by quite a bit. – Jared Jun 25 '18 at 16:16
0

Just got word from Apple. This is finally fixed in Xcode 10 Beta 5

Jared
  • 793
  • 6
  • 16