Search code examples
iosxcodetabssyntax-highlightingsourcekit

Xcode loses syntax highlighting when file is open in multiple tabs


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


Solution

  • Just got word from Apple. This is finally fixed in Xcode 10 Beta 5 šŸ‘