ronnidc / vscode-nunjucks

Nunjucks for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ronnidc.nunjucks
65 stars 18 forks source link

Frontmatter inside njk (nunjucks) is formatted as gray comment color #29

Open surjithctly opened 3 years ago

surjithctly commented 3 years ago

Describe the bug Frontmatter inside njk (nunjucks) is formatted as gray comment color.

To Reproduce Steps to reproduce the behavior:

  1. Create an .njk file
  2. Create a fontmatter using ---
  3. See error

Expected behavior It works fine on markdown image

Screenshots but not on .njk file image

I have contacted material theme. But they says: https://github.com/material-theme/vsc-material-theme/issues/497

This is an issue related to the nunjucks language highlights. As you can see, the MD language extension assign the correct (YAML) tokens to the front-matter elements: image While the nunjucks language extension doesn't assign any specific token, so vscode uses the text color fallback:

image

floriangosse commented 1 year ago

I've the same problem. This can be pretty problemtatic if you have different formatting rules per language.

In the meanwhile I will probably use https://marketplace.visualstudio.com/items?itemName=ginfuru.better-nunjucks. It support front matter detection.