简体   繁体   English

在多个选项卡中打开文件时,Xcode失去语法高亮显示

[英]Xcode loses syntax highlighting when file is open in multiple tabs

I have had an issue with syntax highlighting/coloring since Xcode 9.3.0. 自Xcode 9.3.0起,我在语法高亮/着色方面遇到了问题。 I work in multiple tabs a lot. 我经常在多个标签中工作。 Sometimes I have the same file open in multiple tabs to either have reference to different parts of the file or if I'm using one with the debugger and the other for reference. 有时,我在多个选项卡中打开了同一个文件,以引用文件的不同部分,或者如果我将其中一个与调试器一起使用,而另一个用于参考。

Since 9.3.0, when I launch my app with a file open in more than one tab, I lose part of the syntax highlighting. 从9.3.0开始,当我启动我的应用程序并在多个选项卡中打开文件时,我丢失了部分语法高亮显示。 It seems to be mostly custom classes, (green in the dusk color scheme). 它似乎主要是自定义类(黄昏配色方案中的绿色)。 This can be very tedious with debugging as I have Xcode set to open a preset 'Debug' tab when it hits a breakpoint. 这对于调试非常繁琐,因为我将Xcode设置为在遇到断点时打开预设的“调试”选项卡。 Essentially I will have a file open, launch the app, hit a breakpoint, Xcode opens the same file in the 'Debug' tab, and I lose syntax highlighting when I need it most, to debug. 本质上,我将打开一个文件,启动该应用程序,命中一个断点,Xcode在“调试”选项卡中打开相同的文件,并且在最需要调试的时候失去语法高亮显示。

I have tried the following - Delete derived data folder - Quit Xcode - Restart computer - add $(SRCROOT) to header search paths - cleaned project - cleaned build folders 我尝试了以下操作-删除派生数据文件夹-退出Xcode-重新启动计算机-将$(SRCROOT)添加到标题搜索路径-清理的项目-清理的生成文件夹

Please note, I have also tried this on a brand new project with only a couple of classes and just a few lines of code. 请注意,我还在一个只有几个类和几行代码的全新项目上尝试过此操作。 It still happens. 它仍然发生。

Please also note, I have tried installing a fresh version of Xcode on a brand new user account, devoid of ALL my previous xcode settings and preferences. 另请注意,我尝试在一个全新的用户帐户上安装Xcode的新版本,而没有我以前所有的Xcode设置和首选项。 It still happens. 它仍然发生。

I have also downloaded 9.3.1 and tried it. 我还下载了9.3.1并进行了尝试。 It still happens 它仍然发生

This is driving me crazy. 这真让我抓狂。 I would absolutely love to find a solution to this. 我绝对希望找到解决方案。 I'm hoping this gets to a boss source kit expert who can be my hero! 我希望这能成为可以成为我英雄的老板资源工具包专家! 💪 💪

Example of working syntax-highlighting: 工作语法高亮示例: 语法着色工作

What it looks like after building: 构建后的外观: 在此处输入图片说明

Update: 5/18/18 : Here's a video of what is happening https://youtu.be/fpWV_x17J7U 更新:18/5/18:这是正在发生的事情的视频https://youtu.be/fpWV_x17J7U

Update: 5/18/18 Tested on 9.2.0, doesn't happen, only on 9.3.0 and 9.3.1 更新:5/18/18在9.2.0上进行了测试,仅在9.3.0和9.3.1上才进行测试

Update: 5/18/18 Just tested on a friend's computer and can confirm this is happening for him as well. 更新:5/18/18刚刚在朋友的计算机上进行了测试,可以确认这对他也正在发生。

Steps to reproduce. 重现步骤。

• Update to Xcode 9.3.0 or 9.3.1 •更新到Xcode 9.3.0或9.3.1

• Download and open this basic sample project : https://github.com/provmusic/syntaxHighlightingBug •下载并打开此基本示例项目: https : //github.com/provmusic/syntaxHighlightingBug

• Open ViewController.swift •打开ViewController.swift

• Build -> Syntax coloring still in tact •构建->语法着色仍然完好

• Open a new tab, now having ViewController.swift in both tabs •打开一个新选项卡,两个选项卡中现在都有ViewController.swift

• Build -> Syntax coloring breaks •构建->语法着色中断

For me it was the _code in the first line from above: 对我来说,这是上面第一行中的_code

if let err = err, let errorCode = StorageErrorCode(rawValue: err._code) {
        if errorCode == .objectNotFound {
          print("Asset not found, no need to delete")
          completion(true, nil)
          return
        }
      }

Commented out and back agan solved the problem. 注释掉后,阿根就解决了这个问题。

Just got word from Apple. 刚从苹果公司得到消息。 This is finally fixed in Xcode 10 Beta 5 👍 最终在Xcode 10 Beta 5中修复了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM