samuelcolvin / jinjahtml-vscode

Syntax highlighting for jinja(2) html templates in vscode
https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml
MIT License
135 stars 55 forks source link

v0.20 breaks python language support #147

Open robot-ranger opened 10 months ago

robot-ranger commented 10 months ago

im working on a fastAPI application; installed Better Jinja, and pylance breaks. disable Better Jinja and reload the vscode window and python language support starts working again.

Running in windows, vscode v1.84.0, pylance v2023.20.0

not sure what else to provide. lmk if i can provide anything, but atm i cant use Better Jinja with python apps.

samuelcolvin commented 10 months ago

Thanks for reporting.

No idea what would caus that, no one else has reported similar problems despite a large number of active users.

michelle-arzul commented 6 months ago

I experience the same issue, not just on 0.20.0 but all versions as far back as 0.15.0.

While editing a .py.jinja file, if I set the language to Python, intellisense and syntax highlighting work perfectly (apart from syntax errors at template elements).

If I set the language to Jinja Python, intellisense works like plain text (only existing tokens are suggested, no syntax checking, no tooltips), and syntax highlighting only partially works.

These are coloured correctly:

These remain rendered like plain text:

The same happens both with and without window reloads between switching languages.

I tried disabling all other extensions but the issue persists even with only Python, Pylance, and Better Jinja enabled.

With only Python extension and Better Jinja enabled, completions and tooltips still work with Python language selected but not with Jinja Python, and syntax highlighting is partial as above in both (which indicates that this is vanilla vscode behaviour).

With only Better Jinja enabled, all behaviour is the same in both languages, except around template elements.

This points towards an issue with these extensions cooperating, or the load sequence between them. It could also have to do with the Python interpreter path, as I have multiple local and virtual environments.

Versions:

This happens on both macOS Sonoma 14.3.1 and Windows 10 Pro 22H2 (with vscode running locally or remotely on WSL2 Ubuntu).

michelle-arzul commented 6 months ago

For what it's worth, similar happens with Jinja Ruby, which may be related.

With extensions:

While editing a .rb.jinja file, setting the language to Ruby, both syntax highlighting and language support work.

Setting the language to Jinja Ruby, syntax highlighting still mostly works (not on imported symbols), but language support doesn't.

It's as if Better Jinja allows LSP to run as normal on non-Jinja parts, but completely ignores Solargraph.