Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 external build system code completion

When i use Xcode 4 with an external build system like make, i lose code completion and syntax highlighting. Is there any way to fix this?

like image 712
Johannes Avatar asked Jan 04 '12 12:01

Johannes


People also ask

Does Xcode have code completion?

Xcode tip #9: Xcode has great code completion built right in, but sometimes as you scroll through the options you might find the names are too long to fit. Fortunately, you can just grab the edge of the autocomplete popup and drag it as wide as you want!

How do I get suggestions in Xcode?

Type some code, use either ⎋ or ⌃Space to toggle auto-complete (I'm hooked on Escape ), and Xcode will offer a few intelligent suggestions to complete your code.

What is Xcode build system?

The Xcode build system manages the tools that transform your code and resource files into a finished app. When you tell Xcode to build your project, the build system analyzes your files and uses your project settings to assemble the set of tasks to perform.


1 Answers

A quite ugly solution I have used is to add an additional dummy iOS or Mac OS X Application target that I only use to get code completion and documentation.

Do something like this:

  1. Add a "Cocoa Application" target and name it <project name>-doc.
  2. Add files you like to edit to a new group or use the newly created target group.
  3. Make sure the files you like to edit is marked as members in the <project name>-doc target using the "Target Membership" section in the right side utilities view.

Now edit along and build using your external build system target.

If this is a iOS project you can even take it one step further and add an additional "Empty Application" <project name>-run target used to "fool" Xcode to run your externally built application in the simulator or even on a device, assuming your external build system know how to sign and build universal or just normal binaries with correct architecture(s).

  1. Add a "Empty Application" iOS target and name it <project name>-run.
  2. Edit the scheme for <project name>-run and add your external build system target as a target before the <project name>-run target.
  3. Change the "Run ..." section for <project name>-run scheme by pointing the executable path to the application bundle built by your external build system.

Now edit along and build and run using the <project name>-run target and it will trigger your external target and then run in the simulator or debug on the device. I have done this in combination with a <project name>-doc target and it works fine, just make sure to mark files you edit to only be a member of the <project name>-doc target or else Xcode will try to build things for you.

like image 165
Mattias Wadman Avatar answered Nov 10 '22 08:11

Mattias Wadman