VS Code 的 Jade 语法突出显示很糟糕

VS Code's Jade syntax highlighting is bad

为什么我的 Jade 语法突出显示在 VS Code 中看起来很糟糕? (例如,当我在前面添加行时注释元,最后注释总是)
是我搞砸了语法还是只是 VS Code 的错?

这不是第一次了,开始让我很烦,但我宁愿解决它,因为我真的很喜欢 VS Code

这是我的代码:

    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

如果您将代码放在 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

这有点误导,因为它应该更好地说明问题是找不到您要包含的 jade 文件。如果我生成 "missing" jade 文件,模板将使用节点模块呈现而不会出现错误。

因此,要么是文件丢失,要么是 vs code 中的显示问题。

由于 this issue with the language grammar in VS Code.

,注释中的语法突出显示不正确

includeblock 等未突出显示是因为您使用的是较旧的 "Dark (Visual Studio)" 主题。我们建议您通过执行以下操作更改为 "Dark+ theme":

  • ctrl+shift+p
  • 类型theme
  • Select 列表中的 Dark+(或其他主题)

您似乎也想使用 don't render comment to HTML feature,这是通过使用 //- 而不是 // - 来完成的。