Xcode 8.2 代码补全不起作用 [英] Xcode 8.2 Code Completion Not Working

查看:18
本文介绍了Xcode 8.2 代码补全不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,在 Xcode 8.2 中,我的代码完成已停止工作.我已经清理了我的产品,重新启动了 Xcode,重新启动了我的计算机,并删除了派生数据,但仍然没有运气.我已将此提交给 Apple 支持.有没有人遇到过这个问题并且能够修复它?

For some reason, in Xcode 8.2 my code completion has stopped working. I have cleaned my product, restarted Xcode, restarted my computer, and deleted the derived data, and still no luck. I have submitted this to Apple Support. Has anyone run into this before and been able to fix it?

推荐答案

代码补全在 Xcode 8.2.1 中也停止了对我的工作,并且没有大量的清理、派生数据丢弃或重新启动修复它.过了一会儿,我意识到代码完成只在我正在处理的扩展范围内被破坏.如果手动输入,代码将被正确突出显示并且可以正常编译,因此源代码不会抛弃负责代码完成的任何解析器.

Code completion also stopped working for me in Xcode 8.2.1, and no amount of clean-up, derived data throwaway or restart fixed it. After a while, I realized code completion was only broken within the extension scope I was working on. If typed manually, the code would be correctly highlighted and would compile fine, so it was not an issue of the source throwing off whatever parser is in charge of code completion.

这是它发生的具体上下文,在这个非常简单的例子中:

Here is the specific context in which it happens, in this very simple example:

struct SomeStruct {

    static let foobar1 = {
        return NSBezierPath()
    }()

}

extension SomeStruct {

    static let foobar2 = {
        return NSBezierPath()
    }()

}

代码完成在 foobar1 的实现块中工作正常,但不适用于 foobar2.似乎触发它的扩展中存在 static let .结构和类都会出现此问题.

Code completion works fine within the implementation block of foobar1, but not for foobar2. It's the presence of a static let within an extension that seems to trigger it. The issue appears for both struct and class.

看起来像 Xcode 的一个错误,所以对我来说唯一的解决方法是将 foobar2 移动到 SomeStruct 的主要定义中.

Looks like a bug with Xcode, so the only workaround for me was to move foobar2 into the main definition of SomeStruct.

这篇关于Xcode 8.2 代码补全不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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