edheltzel / better-nunjucks-for-visual-studio-code

🦾 Better Nunjucks for Visual Studio Code with Snippets
https://marketplace.visualstudio.com/items?itemName=ginfuru.better-nunjucks
MIT License
22 stars 1 forks source link

Frontmatter "breaks" extension #21

Closed ReduxFlakes closed 3 months ago

ReduxFlakes commented 3 months ago

So when I woke up today to start working on my website I noticed that all of my .njk and .md that had frontmatter (---) did not have syntax highlighting and snippets did not work.

For some reason having a frontmatter breaks the extension. I tried other extensions related to nunjucks but they seem to work fine, I also tried disabling everything but the issue persists.

Yesterday it was working just fine, this just happened today and I don't know what to do, the only thing I did was shutdown my computer.

I have attached screenshots below to show the issue.

Nunjucks file without frontmatter showing that the extensions behaves correctly

Screenshot 2024-08-02 213157

Nunjucks file with frontmatter showing that the extensions stops working

Screenshot 2024-08-02 213210

The same thing happens with markdown files - in this case without frontmatter and working

Screenshot 2024-08-02 213234

and with frontmatter, not working

Screenshot 2024-08-02 213223

edheltzel commented 3 months ago

Let me see what I can do.

edheltzel commented 3 months ago

@ReduxFlakes what version of VSCode are you using? It seems that July 2024 (version 1.92) release has changed/broken something.

I hate to ask if you could test this to confirm what I am seeing, but download and rollback your VSCode version to the June 2024 release and let me know if the results are the same?

gasatrya commented 3 months ago

@edheltzel same thing for me and yes, I am currently using the latest version of VS Code.

Edit: Sorry, my issue is color code, they are now the same color. I am using "One Monokai Theme" theme. Tried different theme, still the same result.

image

edheltzel commented 3 months ago

If you try downloading vscode v1.91.1 and not update to 1.92 the extension works.

I tested both versions of vscode with better nunjucks v0.2.72 and v.0.2.6

In vscode 1.91.1 both versions of the extension, v0.2.72 & v0.2.6 work as expected.

In vscode 1.92 both are broken


For my Ref: https://github.com/microsoft/vscode/issues/224680 Images for context: (posted in the ref issue ☝️)

v1.91.1 v1.92
v1 91-Screenshot 2024-08-03 at 8 12 35 AM v1 92-Screenshot 2024-08-03 at 8 11 17 AM
v1 91-Screenshot 2024-08-03 at 8 12 41 AM v1 92-Screenshot 2024-08-03 at 8 11 32 AM
v1 91-Screenshot 2024-08-03 at 8 12 45 AM v1 92-Screenshot 2024-08-03 at 8 13 16 AM
ReduxFlakes commented 3 months ago

@edheltzel I am using the latest. I will try rolling back to see, I didn't noticed VS Code had updated since I have the "new release" tab disabled.

ReduxFlakes commented 3 months ago

@gasatrya yes that's the same issue I have, in my case I'm using Gruvbox and everything turns green, another interesting issue is when I have the char # anywhere, everything after it turns red .

RedCMD commented 3 months ago

Nunjucks is using an outdated FrontMatter include

The FrontMatter integration should be updated to match Markdowns

https://github.com/edheltzel/nunjucks-for-visual-studio-code/blob/05196ca36343d76af521f1dd0b7da894c7c95963/src/syntaxes/nunjucks.tmLanguage.json#L123-L139

https://github.com/microsoft/vscode-markdown-tm-grammar/pull/162

https://github.com/microsoft/vscode-markdown-tm-grammar/blob/main/markdown.tmLanguage.base.yaml#L202-L216

edheltzel commented 3 months ago

@RedCMD This is very close... it resolves the syntax highlighting for nunjucks, but breaks the frontmatter syntax highlighting. I had to dive a little deeper here - Your solutions definitely helped and gets me pointed in the right direction moving forward. I need to do a little more testing but I think we've got a fix THANK YOU 🎉

ReduxFlakes commented 3 months ago

@edheltzel can confirm that the new 0.3.0 release fixes the issue on the latest version of VS Code, thanks!

gasatrya commented 3 months ago

Wow, that was fast! @edheltzel and thanks @RedCMD