Xcode 9 代码完成和突出显示不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46414467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:18:22  来源:igfitidea点击:

Xcode 9 code completion and highlighting not working

xcodexcode9

提问by Nic Hubbard

I have seen many threads about this online, but not for Xcode 9. For some reason code completion and syntax highlighting is no longer working. Last week it was fine.

我在网上看到了很多关于这个的话题,但不是针对Xcode 9. 出于某种原因,代码完成和语法高亮不再有效。上周还好。

Using the GM build.

使用 GM 构建。

Anyone have this issue or know how to resolve it? A restart of Xcode and my computer did not help.

任何人都有这个问题或知道如何解决它?重新启动 Xcode 和我的电脑没有帮助。

回答by gpdawson

In Finder I navigated to user->Library->Developer->Xcode->DerivedData and deleted the subfolder of the project in question. After next build of the project the syntax highlighting and code completion returned.

在 Finder 中,我导航到 user->Library->Developer->Xcode->DerivedData 并删除了相关项目的子文件夹。在项目的下一次构建之后,语法突出显示和代码完成返回。

回答by C. Bess

Quitting Xcode then reopening it works for me.

退出 Xcode 然后重新打开它对我有用。

回答by Khang Azun

In my situation, there are a few of .swift files not working. I've overcome by removing these files from project and re-adding them back.

在我的情况下,有一些 .swift 文件不起作用。我通过从项目中删除这些文件并重新添加它们来克服。

回答by DawnSong

To make it work again, I have to restart the macOS System. I'm using Xcode 11.0 (11A420a), at the same time, Xcode 10 works OK. So I think there is some process does not work, which should work for code coloring.

为了让它再次工作,我必须重新启动 macOS 系统。我正在使用 Xcode 11.0 (11A420a),同时,Xcode 10 工作正常。所以我认为有一些过程不起作用,这应该适用于代码着色。

回答by Chandan

I have observed the same problem while writing in swift on xcode 9.0, Seems it is fixed in 9.1 i am using 9.1 which is fine, please update xcode to 9.1 or newer.

我在 xcode 9.0 上用 swift 编写时发现了同样的问题,似乎它在 9.1 中得到修复,我使用的是 9.1,这很好,请将 xcode 更新到 9.1 或更新版本。