Can corrupt Xcode project explain broken intellisense?

We have a very large project that consists of 1000+ source files that builds 20+ targets (libraries and different versions of our app). Most is C++.

We recently started having problems with intenseness. The strange thing is that compiling and navigation works but simple code completion is suddenly very broken.

I manage to narrow it down to a simple use-case by deleting all the targets but one, and all the source files but two. I have a simple main.cpp that includes one header file test.h. If test.h is in the same folder as main.cpp, then intellisense works, but placing it in any other folder (all part of my project), intellisense stops working.

I've re-created this simple project from scratch, reproducing the file structure. Intellisense would work in this case. I could open the two projects side by side and went through all project and target settings and they were all identical, but the one from our original project does not work.

Can it be that the project contains something corrupt that was built up over the years? I really do not want to create the entire project and targets again from scratch.

I've done all the tricks I could find on the forums (Removing Derived folder; opening and closing Xcode; etc.). Nothing works, except apparently creating the project from scratch. The problem is also present in latest Xcode 15 Beta.

Any ideas on how to fix this?

Replies

I dug a bit deeper and found more info. It does not seem to be a corrupt Xcode project, but a setting in the top level project.

I found that the issue is caused with Header Search Paths. We unfortunately have one or two places where there are file name clashes. To get around this, we set Use Header Maps to No and each target has the correct Header Search Paths to find the correct file.

It turns out that this is causing the issue.

Attached is an image of a very simple project (cannot attach project) to demonstrate the issue. The image should make it pretty clear on how to reproduce the project.

The project contains two targets. The SearchPathIssue Intellisense Working target has Use Header Maps set to Yes (default) while SearchPathIssue Intellisense Broken has it set to No and has a Header Search Path to correctly find the headers. If the search path is not given, then the project does not build.

If you open main.cpp you can type "shape." to see the code completions. It works when the target SearchPathIssue Intellisense Working is selected and it does not work when SearchPathIssue Intellisense Broken is selected.

I do not have a work-around for the issue yet. Maybe someone does? I've raised a bug using Feedback Assistant and will post here if I get a reply.