2016-02-19 19 views
0

爲什麼我的Jade語法突出顯示在VS代碼中看起來不好?(例如,當我添加行之前評論元,總是最後評論)
我弄亂了語法,或者它只是VS Code的錯?VS Code的Jade語法突出顯示不好

這不是第一次,它開始真的激怒了我,但我寧願解決這個問題,因爲我真的很喜歡VS代碼

這裏是我的代碼:

 
    doctype html 
    html 
     head 
      title= title 
      meta(name='viewport', content='width=device-width, initial- scale=1') 

      // - meta(name='viewport', content='width=device-width,  initial-scale=1, maximum-scale=1, user-scalable=no') 

      // - Files that need to be included at top 
      include ./partials/_include_at_top.jade 
      block extra-styles 
     body 
      include ./partials/_main-nav.jade 
      .page 
       block content 

      // - Files that need to be included at bottom 
      include ./partials/_include_at_bottom.jade 


Images

回答

4

語法突出顯示與this issue with the language grammar in VS Code的評論不符。

includeblock等不是突出顯示是由於您使用舊的「黑暗(Visual Studio)」主題。我們建議您更改爲 「黑+主題爲」 通過執行以下操作:

  • CTRL + 轉變 + p
  • 類型theme
  • 選擇黑暗從列表+(或其他主題)

你也出現t o想要使用don't render comment to HTML feature,這是通過使用//-而不是// -來完成的。

+1

**很酷。非常感謝!**我沒有輕蔑將答案標記爲有用,但肯定有人應該這樣做。 – BarnabasMakkay

1

如果您將代碼放在jade-lang.com處,您會看到它的狀態爲

Jade:10 
    8| 
    9|   // - Files that need to be included at top 
    > 10|   include ./partials/_include_at_top.jade 
    11|   block extra-styles 
    12|  body 
    13|   include ./partials/_main-nav.jade 

the "filename" option is required to use "include" with "relative" paths 

這是一個有點missleading,因爲它應該更好地表明,問題是,你的包括玉文件無法找到。如果我生成「缺失」的玉文件,模板將與節點模塊無誤地呈現。

因此,無論文件丟失還是VS代碼中的顯示問題。

+0

是的,我得到了正確的文件路徑,因爲他們將估計的額外內容添加到佈局。我在第一次設置Express時檢查了「文件名選項」,我沒有看到它在app.js中設置了哪個選項。我會找到一些東西回來。 – BarnabasMakkay

+0

但是,由於事情加載正確,也許VS Code只有一個小的語法問題。 – BarnabasMakkay