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! 💪


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

In 9.3, I've tried with a custom class, opened in 2 panels, set a breakpoint.


I still get full syntax hilighting.


In how many panes do you open the file ?

Does it occur if you open different files ?


You could as usual try the clean Build folder (option clean in Project menu)

I've found that it can sometimes still work when open in 2 tabs. However in 3+ it always fails. Can you please try this? Also, running the project seems to break the syntax highlighting more often than just building it.


And as I mentioned in my post, I have tried cleaning the build folder many times.


Thanks for the reply!

I've created a screen recording of what is happening here:

https://youtu.be/fpWV_x17J7U

I opened a file in 6 panels. Still working OK.


I ran the project, still OK.


XCode 9.2 here.


Is your project a large size project ?

Hi Claude31, thanks again for your response and testing. As was stated in the original post this is being testing on a new project and has been occuring since 9.3.0. It is good to know that it is not happening in 9.2.0. I have been meaning to test this. I think I will test as well and report back. Cheers!

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

Just downloaded and tested on 9.2.0 and syntax coloring works perfectly in these scenarios.

This is strictly a 9.3.0 and 9.3.1 bug.

Xcode loses syntax highlighting when file is open in multiple tabs
 
 
Q