问题与code自动完成/语法英寸x code 4.x的突出 [英] Issue with code autocompletion / syntax highlighting in XCode 4.x

查看:174
本文介绍了问题与code自动完成/语法英寸x code 4.x的突出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的项目之一,在X code进行比较奇怪的问题。

I am having a rather strange issue in XCode on one of my projects.

当我开始写我的code,我用自动完成提示无数条目我。出于某种原因,从昨天起,这已停止工作。我现在得到奇怪的自动完成条目,如和,中,刘德华,MyCompanyName等。

When I start to write my code, I am used to the auto-completion suggesting numerous entries for me. For some reason, since yesterday, this has stopped working. I now get strange auto-completion entries such as "and", "the", "Andy", "MyCompanyName" etc.

这从来没有发生过,所以我很困惑,为什么它现在已经发生了,只有我的项目之一。我搜索这个网站相当长的一段时间,以任何修正和我已经尝试干净导出的数据,退出X code,删除从X code项目,并重新启动工作空间和用户文件,但这样做后,自动完成作品了一会儿,然后大约30秒的编码后,再次打破了。

This never happened before and so I am confused as to why it has occurred now, and only on one of my projects. I searched this site for quite some time for any fixes and I've attempted to clean Derived Data, quit XCode, delete the workspace and user files from the XCode project and restart, but after doing so, the auto-complete works for a while, then breaks again after about 30 seconds of coding.

我有时会看到自动完成的解决方案,而只是纯文本(无级指标),那么它完全停止工作的其他时间。

I can sometimes see auto-complete solutions, but just plain text (no class indicators), then other times it stops working entirely.

有其他人经历过这样的事情,并能提供一些解决方案?

Has anybody else experienced anything like this and could provide some solution?

推荐答案

我忍了好久一个项目,一直输自动完成和语法高亮。 delete一个导出的数据文件夹,并重新启动X $ C $Ç将暂时修复它,并最终几乎变成了肌肉记忆。我的问题似乎是通过使用包含多个项目,其中许多是互相依赖的工作空间加剧。原来,问题是用铿锵索引。该项目将顺利地编译,但看着从它与散落的错误索引的输出。解决所有这些解决这些问题,我

I suffered for a long time with a project that kept losing auto-completion and syntax highlighting. Deleteing the Derived Data folder and restarting Xcode would fix it temporarily, and eventually that almost became muscle memory. My problem seemed to be exacerbated by using a workspace that contained multiple projects, many of which were dependant on each other. It turns out the problem was with the clang indexer. The project would compile cleanly, but looking at the output from the indexer it was littered with errors. Fixing ALL these resolved my problems.

在做什么:确保全部中的目标全部工作空间中的项目编译干净。这是没有的任何警告。这是我的一个大失败 - 我有,只是没有干净编译老的目标。有些不习惯,可以删除,其他人无弧使用的模块在已转换为ARC目标(转换这些目标也是如此),有的只是需要code固定。

BEFORE DOING ANYTHING: make sure ALL the targets in ALL the projects in your Workspace compile cleanly. That's without ANY warnings. This was a big failure on my part - I had old targets that just didn't compile cleanly. Some of these were unused and could be deleted, others were non-ARC that used modules in targets that had been converted to ARC (converted those targets too), and some just needed the code fixing.

一旦你解决所有这些问题,我们需要知道的第一件事就是索引器出现故障,通过做项目的一个完整的指数。

Once you've resolved ALL those problems, the first thing we need to know is where the indexer is failing, by doing a complete index of your project.


  • 首先,确保X code为关闭,然后打开了索引警告
    通过输入终端的消息级别:

  • First, Make sure Xcode is closed, then turn up the indexer warning message level by entering in the Terminal:

 defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3


  • 然后找到适合你的项目/工作区导出的数据文件夹(可能的〜/资源库/开发/ X code / DerivedData / 您的项目名称,一些胡言乱语),并删除它(但保留导出数据文件夹打开,因为你可能要回去做这几次。

  • Then find the Derived Data folder for your project/workspace (probably ~/Library/Developer/Xcode/DerivedData/your project name-some gibberish), and delete it (but keep the Derived Data folder open because you'll probably have to go back and do this a few times.

    接下来,打开控制台应用程序,然后单击清除显示,和过滤器IDE设置为只显示我们感兴趣的消息。

    Next, open the Console app and click Clear Display, and set the filter to "IDE" to only show the messages we're interested in.

    最后,打开X code和项目/工作区是造成你的问题,你会看到控制台启动与消息填满。

    Finally, open Xcode and the project/workspace that's causing your problems, and you'll see the console start to fill up with messages.

    要查找错误,更改控制台过滤器,以错误: - 我们的目标是把这些减少到零

    To look for errors, change the Console filter to "error:" - our aim is to reduce these to zero.

    我发现大多数的错误失踪头文件。 X code本身似乎比索引更聪明。这似乎是能够找到并包括来自其他项目的头文件索引不能。

    The majority of errors I found were missing header files. Xcode itself seems to be smarter than the indexer. It seems to be able to find and include header files from other projects that the indexer can't.

    所以,任何地方你看的致命错误:'somefile.h找不到文件的时,请确保您添加该文件的路径用户头文件搜索路径目标的构建设置。我发现要做到这一点,最好的方法是双击在球场上得到弹出,并且文件夹从Finder拖进去。这增加了新的条目,但假设它在同一个工作区,它增加了一个相对文件路径(如果您在未来的移动工作区文件夹,这是很重要)。如果你有多个目标为同一个项目,你可以在项目而非目标水平设置搜索路径,并设定目标搜索路径的 $(继承)

    So, anywhere you see "fatal error: 'somefile.h' file not found", make sure you add the path of that file to the User Header Search Paths in the target's build settings. The best way I've found to do this is to double click on the field to get the popup, and drag the folder from the finder into it. This adds a new entry, but assuming it's in the same workspace, it adds a relative file path (this is important in case you move your workspace folder in the future). If you've got multiple targets for the same project, you can set the search path at the project rather than target level, and set the target search paths to $(inherited).

    您可能有一个库或框架类似的问题 - 再次,更新相应的搜索路径

    You might have similar problems with Libraries or Frameworks - again, update the appropriate search path.

    一旦修正了一些错误,关闭X code,清除控制台,删除项目的导出数据,开放式X code和让它指数再次。

    Once your fixed some errors, close Xcode, clear the console, delete the project's Derived Data, open Xcode and let it index again.

    重复,直到所有的错误都没有了。

    Repeat until all your errors are gone.

    一旦你在这个好地方,code自动完成和语法高亮应该像一个魅力:)

    Once you're in this good place, code autocomplete and syntax highlighting should work like a charm :)

    这篇关于问题与code自动完成/语法英寸x code 4.x的突出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆