2017-08-08 54 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++語言特定的。儘管如此,解決方案仍然有效