Visual Studio Code and phantom errors/warnings

This isn’t the biggest problem in the world, in fact it is really just an annoyance.

Is it possible to stop the warnings/errors in VSC when using Jinja templates at the top of a file with lovelace_gen?

I asked in another thread but it was off topic so I didn’t want to keep pursuing it there. It was suggested that the “Better Jinja” extension would solve the ‘problem’ but it didn’t seem to work for me. Could I have a setting mis-set?

I’m using stand alone VSC not the add-on.

(It’s a shame the HA extension doesn’t deal with it.)

For example this (partial) code

# lovelace_gen

{% set tap_action = tap_action | default('none') %}
{% set hold_action = hold_action | default('none') %}
{% set color = color | default('var(--paper-item-icon-color)') %}
{% set aspect_ratio = aspect_ratio | default('1/1') %}
{% set font_size = font_size | default('12px') %}
{% set last_changed = last_changed | default(true) %}

type: custom:button-card
aspect_ratio: {{ aspect_ratio }}
entity: {{ entity }}
name: {{ name }}
icon: {{ icon }}

displays like this

image

A while (1 year) ago there were suggestions for a solution.