samuelcolvin / jinjahtml-vscode

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

Question: Syntax highlight in double quoted string (Ansible world) #92

Closed Sispheor closed 3 years ago

Sispheor commented 3 years ago

Hi,

I'm an Ansible/vscode user.

In Ansible world, jinja in the yaml file need to be placed in double quote.

If we try to remove them we get somethnig like this as error

We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

And the result on vscode is that everything it's detected as a string. As it's a string it's normal I guess :) image

It's possible to twist a bit this plugin to for a syntax highlight when we detect for example the pattern with a key and double quote? key: "{{ jinja here }}"

Many thanks by advance for your answer.

samuelcolvin commented 3 years ago

probably the same as #12 - long standing issue but I don't know of a fix.