Open Kaauw opened 2 years ago
An update to this extension or to vscode?
Maybe, I don't open this folder for a month or two maybe.
I tried with many themes and the issue is still present. If I open an HTML file formated in Jinja2HTML, the problem is also present.
humm, seems to be broken for me too. Seems like something must have changed in vscode.
Happy to accept a PR if someone can find a fix, but since I don't use vscode day-to-day, I can't devote the time to fix this myself.
I've been looking at this for some time. It seems vscode somehow changes in how it interpreted grammars.
I tried the other "Jinja" extension which hasn't been updated for ages and it seems to be broken in the same way.
Seems like it might involve rewriting the grammar completely to get it to work.
@nathan-barrett do you have any idea what might have changed in VS code to cause this to break?
See https://github.com/microsoft/vscode/issues/158379, I'm waiting for a respond from there.
Also worth noting that for me only one brace is highlighted. I tried changing the regex in the syntax definition, but nothing seemed to work.
I also tried installing a different systax definition, e.g. from https://github.com/shikijs/shiki but I got the same problem.
Updated: macro -> regex
Weird, let me take a look this afternoon and see if I can shake anything loose! thanks @samuelcolvin
https://github.com/microsoft/vscode/issues/158379
@RedCMD @thqby Thanks a lot for helping out! heart
@samuelcolvin The issue samuelcolvin/jinjahtml-vscode#107 is caused by us enabling bracket pair colorization by default in 1.67 which shipped early May 2022. @Kaauw can get the previous behavior by configuring
"editor.bracketPairColorization.enabled": false
Disabling bracketPairColorization
does not fix the issue on my end, I still don't get any color for the jinja brackets/variables.
if you're getting no syntax highlighting at all that sounds like a separate issue
has the correct language been assigned to your file?
jinja2
etc
can you send a screenshot and a copy of your code
Seeing something similar happen in .cpp.j2
:
Certain single-bracket enclosures get highlighted:
And here we see perfectly fine jinja code being missed (because it's enclosed within such an identified block):
I use cpp extensively with jinja, so this makes the plugin quite useless at the moment (also I miss not being able to lint the code, even though it's quirky and limited).
Has this changed recently @dromer?
I'm only using the plugin since this week and this is the only highlighting I've seen.
The main problem that I see is that any single set of { }
is being identified as belonging to the .j2
syntax and anything inside of it will subsequently be highlighted incorrectly. Instead it should only look for {% %}
and {{ }}
enclosed code.
(I understand why the later doesn't work inside " "
, but that's a separate issue I assume)
Sorry if I can't give any more info. I can link to these files if you need them.
humm, have you tried disabling bracketPairColorization
?
Then the jinja2 highlighting is completely broken:
(looks exactly the same as if the file just had .cpp
extension. only difference is that linting is now disabled)
I think you confuse bracketPairColorization
with syntax highlighting
the bright colored bracket highlighting is handled separately by vscode
and is the same for all languages
the extension just tells vscode what type of brackets exist
if you try just the plain cpp language with bracketPairColorization
enabled
all cpp brackets will be highlighted
other than {{class_name}}
it doesn't seem like any of jinja2 syntax highlighting is working in any of your examples.
Jinja2 probably doesn't inject itself with enough priority
@RedCMD indeed, thnx for the clarification. Still it seems that the jinja2 scope isn't recognized when enclosed in a pair of single brackets. At least that's what I think we're observing here.
Dear Team,
I think an update broke the synthaxe highlight. All braces are now colorized, not only jinja2 braces. With this example :
As raw if you want to test :
Thanks,
Benjamin