2017-08-08 57 views
0

我注意到一些突出显示不一致的特殊语法。 class,if,else,whilebreak关键字由于某种原因未着色。即使更改颜色主题并重新启动Xcode,此问题仍然存在。我使用的是Civic主题,这是Xcode中的默认主题之一。这个问题似乎是特定于语言的,因为这只发生在C++上,而它不适用于Objective-C或Python。Xcode 8.3.3在C++中使用错误语法高亮显示

enter image description here

+0

什么是您使用的主题名称? –

+0

@AlexG我已将它更新到 – Senyokbalgul

+0

你有权访问主题文件吗? –

回答

0

我已经找到了解决方案,它是远远不够理想,并从外观上来看,这似乎是一个Xcode错误。

  1. 打开Preferences窗口
  2. 转到Locations标签
  3. 点击旁边的箭头/Users/Library/Developer/Xcode/DerivedData
  4. 转到User Data
  5. 转到FontAndColorThemes
  6. 打开任何.xccolortheme文件和Xcode

    <key>xcode.syntax.identifier.class</key> 
    <string>0.115602 0.660894 0.635056 1</string> 
    <key>xcode.syntax.identifier.class.system</key> 
    <string>0.221291 0.537118 0.556094 1</string> # change this line 
    
    <key>xcode.syntax.identifier.function</key> 
    <string>0.115602 0.660894 0.635056 1</string> 
    <key>xcode.syntax.identifier.function.system</key> 
    <string>0.221291 0.537118 0.556094 1</string> 
    

用于xcode.syntax.identifier.class.system颜色代码并不等同于的xcode.syntax.identifier.function.system这引起了class关键字不被着色。所以解决方案是让他们一样。对所有其他关键字执行相同操作。

由于我无法理解的原因,为单色主题更改该行会自动修复所有颜色主题的此错误。另外,我还没有弄清楚为什么这个bug是C++语言特定的。尽管如此,解决方案仍然有效