Monday, July 31, 2017

No Code Completion or Syntax Highlighting in Xcode Unit Test Target with “Defined Module” enabled

Leave a Comment

We have a project with a Unit Test target that has "Defines Module" enabled, due to a mix of Objective C and Swift. With that setting enabled, syntax highlighting and code completion stops for all non-language items. IE code completion will list language level stuff like NS_ENUM and for loop, but not NSString and not any of our classes.

The same thing happens if I create a new project, set "Defines Module" to YES. Syntax Highlighting and Code Completion fails in the Unit Test Code, set it to NO it starts working again.

We have tried all the usual ways to get things to work, Deleting "Derived Data", Checking/Unchecking "Suggest Completions While typing" and "Enable type-over Completions", deleting "~/Library/Caches/com.apple.dt.Xcode", deleting items in var/folders/, adding some clean up scripts to the post build phase, setting the main target to "Defines Module" as well, and of course endless restarts of Xcode and macOS.

I have repo'd this on 3 different Macs (Sierra) with Xcode 8.3.2 and Xcode 8.2. I have one team member that is not having this issue and the only real difference seems to be that he's still on El Cap.

Here is a list of some of the things we've tried:

Xcode 8 syntax highlighting doesn't work

How to Empty Caches and Clean All Targets Xcode 4

Xcode 8.2 Code Completion Not Working

One Weird Trick to Fix Autocomplete in Xcode

Apple Dev Forums

Has anybody had luck with getting this to work (other than turning off "Defines Module" in the Test Target)? My next step is to file a Radar.

1 Answers

Answers 1

Looks like you have arm64 in your Debug configuration for Valid Architectures. May be because of that you are getting this error. Try removing arm64 on your valid architecture inside debug configuration and try building it.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment